#include <stdio.h>

int main(void){
    char top[10+1];
    int bottom;
    int w[] = {1, 9, 6, 4, 6, 6, 4, 6, 9, 1};

    while (scanf("%s", top)!= EOF){
        bottom=0;
        for (int i=0; i<10; i++){
            bottom += w[i]*(top[i] - '0');
        }
        bottom %= 10;
        printf("%d\n", bottom); 
    }

    return 0;
}