#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char pins[999];
gets(pins);
int pin[21];
int len = 0;
for (char *s, *p; *s!=NULL; p=s, ++len) {
s = strchr(s, ' ');
}
int score = 0;
for (int i=0, index=0; i<9; ++i) {
if (index == 10) ++index;
else sum += pin[index+2]
}
sum += pin[index];
if (pin==10) sum += pin[index+1]*2;
else {
sum += pin[index+1];
if (pin[index] + pin[index+1] == 10) sum += pin[index+2];
}
}