#include <iostream>
using namespace std;

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