#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

void solve62(string s) {
    vector<int> v;
    REP(i,10) {
        v.push_back(s[i] - '0');
    }
    REP(i,9) {
        vector<int> w;
        REP(j,9-i) {
            w.push_back(v[j] + v[j+1]);
        }
        swap(v,w);
    }
    cout << to_string(v[0]).back() << endl;
}

int main() {
    string s;
    while(cin >> s) {
        solve62(s);
    }
    return 0;
}