#include<stdio.h>


int hoge(int x[]) {
    
    for (int j=9; j>=0; j++) {
        for (int i=0;i<j; i++) {
            x[i] = (x[i] + x[i+1]) % 10;
        }
    }
	
    return x[0];
}

int main() {
    char a[15];
    
    while (~scanf("%s",a)) {
        int c[10];
        for (int i=0; i<10; i++) {
            c[i] = a[i] - '0';
        }
        
        c[0] = hoge(c);
        printf("%d\n",c[0]);
    }
    return 0;
}