#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back

int main() {
    char c[11];
    int n[11];
    while(~scanf("%s\n", c)) {
        rep(i,10) n[i] = c[i] - '0';
        rep(i,9) rep(j, 9-i)
            n[j] = (n[j] + n[j+1]) % 10;

        cout << n[0] << "\n";
    }
    
    return 0;
}