#include <iostream>
#include <string>
using namespace std;

string s;

void solve() {
    if (s.size() == 1) return;
//    cout << s << endl;
    string t = s;
    int a, b;
    for (int i = 0; i < s.size()-1; i++) {
        a = s[i] - '0';
        b = s[i+1] - '0';
//        cout << a << ' ' << b << endl;
        if (a+b >= 10) {
            t[i] = a + b - 10 + '0';
        } else {
            t[i] = a + b + '0';
        }
//        cout << t[i] << endl;
    }
    copy(t.begin(), t.end(), s.begin());
    s.erase(s.end()-1);
    solve();
}

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