#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#define N 10
using namespace std;

int main(){
    string inp;
    cin >>inp;
    vector<int> vec;
    for(int i = 0; i < N; i++){
        if(inp[i] == '0'){
            vec.push_back(0);
        } else{
            vec.push_back((int)inp[i] - '0');
        }
    }
    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;
    }
    cout <<vec[0] <<endl;
    return 0;
}