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

int main() {
    string s;
    while (cin >> s) {
        while (1 < (int)s.size()) {
            stringstream ss;
            for (int i=0; i<(int)s.size()-1; ++i) {
                ss << ((s[i] - '0') + (s[i+1] - '0')) % 10;
            }
            s = ss.str();
        }
        cout << s << endl;
    }

    return 0;
}