#include <iostream>
#include <cmath>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;
#define loop(i,a,b) for(ll i=(a); i<ll(b); i++)
#define rep(i,b) loop(i,0,b)

typedef vector<int> vi;

int solve(string const& s){
    vi v(10);
    rep(i, 10) v[i] = s[i] - '0';
    while (v.size() != 1){
        vi w(v.size() - 1);
        rep(i, w.size()){
            w[i] = v[i] + v[i + 1];
            w[i] %= 10;
        }
        swap(v, w);
    }
    return v.front();
}

int main(){
    string s;
    while (cin >> s){
        cout << solve(s) << endl;
    }
}