#include <stdio.h>

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

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

    return 0;
}