#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int main(){
    int a,b;
    char num[11];
    char tmp[3];
    while(scanf("%s",num) != EOF){
        for(int i=0;i<9;i++){
            for(int j=0;j<9-i;j++){
                a = num[j]-'0';
                b = num[j+1]-'0';
                a += b;
                sprintf(tmp,"%d",a);
                num[j] = tmp[strlen(tmp)-1];
            }
        }
        cout << num[0] << endl;
    }
}