#include <iostream>
using namespace std;
#define loop(i,a,b) for(int i=a; i<(int)(b); i++)
#define rep(i,n) loop(i,0,n)
#define all(c) (c).begin(), (c).end()

int main(){
    unsigned long long n;
    while (cin >> n){
        int a[2][10];
        int *next = a[0], *cur = a[1];
        rep(i, 10){
            cur[i] = n % 10;
            n /= 10;
        }
        rep(i, 9){
            rep(j, 9 - i){
                next[j] = (cur[j] + cur[j + 1]) % 10;
            }
            swap(next, cur);
        }
        cout << cur[0] << endl;
    }
}