#include <iostream>
using namespace std;

int main() {
    char input[11] = "";
    while (cin >> input) {
        for (int i = 0; i < 9; i++) {
            for (int j = 9; j > i; j--) {
                input[j] = (input[j] - '0' + input[j - 1] - '0') % 10 + '0';
            }
        }
        cout << input[9] << endl;
    }
}