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

int main(){
    char c;
    vector<int> v1,v2;

    while(cin>>c){
        v1.push_back(c-'0');

        for(int i=0;i<9;i++){
            cin>>c;
            v1.push_back(c-'0');
        }

        cin.ignore();

        do{
            v2.clear();
            for(int i=0;i<v1.size()-1;i++){
                v2.push_back((v1[i]+v1[i+1])%10);
            }
            v1=v2;
        }while(v2.size()>1);

        cout<<v2[0]<<endl;

        v1.clear();
    }

    return 0;
}