#include <iostream>
using namespace std;

int main(){
    long long int tmp,cast = 10,count,n,a[10];
    while(cin >> n){
        for(int i = 0;i<10;i++){
            a[i] = n % cast;
            n /= cast;
        }
        for(count = 1;count < 10;count++){
            for(int i = 0;i < 10 - count;i++){
                tmp = a[i];
                a[i] = (tmp + a[i+1]) % 10;   
            }
        }
        cout << a[0] << endl;
    }
    return 0;
}