#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<utility>
#include<cctype>
using namespace std;

#define ull unsigned long long
#define ll long long
#define rep(i,j) for(int i=0;i<j;++i)
#define loop(i,a,j) for(int i=a;i<j;++i)
#define mpi(it,table,T,E) for(map<T,E>::iterator it = table.begin();it!=table.end();++it)
#define PI 3.141592654
/*
ifstream fin("input.txt");
ofstream fout("output.txt");
#define cin fin
#define cout fout
*/

int solve(vector<int> mat){
	if(mat.size() == 1)return mat[0];
	
	vector<int> new_vector;

	rep(i,mat.size()-1){
		new_vector.push_back((mat[i]+mat[i+1])%10);
	}
	return solve(new_vector);
}
int main(){
	char number[15];
	while(scanf("%s",number) != EOF){
		vector<int> mat;
		rep(i,10){
			mat.push_back(number[i]-48);
		}
			
		printf("%d\n",solve(mat));
	}
	return 0;
}