#include <iostream>

using namespace std;

int main()
{
    string str;

    while (getline(cin, str)) {
        int ord[10];

        for (int i = 0; i < 10; i++) 
            ord[i] = str[i] - '0';
        
        for (int i = 9; i >= 0; i--) 
            for (int j = 0; j < i; j++) 
                ord[j] = (ord[j] + ord[j + 1]) % 10;
        
        cout << ord[0] << endl;
    }

    return 0;
}