#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>=n;i--)
#define INF 999999999
#define INF_M 2147483647
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
 
int main() {
    int a[10];
    while(~scanf("%1d", &a[0])) {
        rep(i,1,10) scanf("%1d", &a[i]);
        repr(i,9,1) {
            rep(j,0,i) {
                a[j] = (a[j] + a[j+1]) % 10;
            }
        }
        cout << a[0] << endl;
    }
    return 0;
}