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

int main(){
    vector<int> vec;
    long long int num;
    scanf("%lld", &num);
    for(int i = 1000000000; i >= 1; i /= 10){
        //cout <<num / i <<" " <<num % i <<endl;
        vec.push_back(num / i);
        num %= i;
    }
    
    /*for(int i = 0; i < vec.size(); i++){
            cout <<vec[i] <<" ";
    }
    cout <<endl;
    */
    
    while(vec.size() > 1){
        vector<int> tmpvec;
        for(int i = 0; i < vec.size() - 1; i++){
            tmpvec.push_back((vec[i] + vec[i + 1]) % 10);
        }
        vec = tmpvec;
        
        /*for(int i = 0; i < vec.size(); i++){
            cout <<vec[i] <<" ";
        }
        cout <<endl;
        */
        
    }
    cout <<vec[0] <<endl;
    return 0;
}