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

int solve(int *line,int count){
    int thisLine[count];
    for(int i=0; i<count; i++){
        thisLine[i]=(line[i]+line[i+1])%10;
    }
    if(count>1){
        return solve(thisLine,count-1);
    }else{
        return thisLine[0];
    }
}

int main()
{
    string str;
    int line[9];
    while(cin>>str){
        for(int i=0; i<9; i++){
            line[i]=((int)str[i]+(int)str[i+1]-96)%10;
        }
        cout<<solve(line,8)<<endl;
    }
    return 0;
}