#include <bits/stdc++.h>

using namespace std;

int v(char c) {
    return c - '0';
}

int main() {
    string s;
    while (cin >> s) {
        int sz = s.size();
        while (--sz != 0)
            for (int i = 0; i < sz; i++)
                s[i] = (v(s[i]) + v(s[i + 1])) % 10 + '0';

        cout << s[0] << endl;
    }

    return 0;
}
