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

string Calc_Bottom( string str )
{
    if( str.size() == 1 )
        return str;

    string res = "";

    int i = 0, j = 1;
    while( j < str.size() )
    {
        res += ( ( ( str[i] - '0' ) + ( str[j] - '0' ) ) % 10 ) + '0';
        i++;
        j++;
    }

    return Calc_Bottom( res );
}

int main()
{
    string str;

    while( cin >> str )
        cout << Calc_Bottom( str ) << endl;

    return 0;
}
