#include <stdio.h>
#include <ctype.h>

int main() {
    int soucet = 0, temp, licho = 0;
    int c;
    
    while ((c = getchar()) != '\n') {
        if (isdigit(c)) {
            licho++;
            temp = c - '0';
            if (licho % 2 == 0) temp *= 2;
            if (temp > 9) temp -= 9;
            soucet += temp;
        }
    }
    printf("%d\n", ((10 - (soucet % 10)) % 10));
    return 0;
}
