#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

int main(){
	
	string s;
	
	while(cin>>s){
		
	vector<int> a;
		rep(i,s.size()){
			a.push_back(s[i]-'0');
		}
		
		
		while(a.size()!=1){
			vector<int> b;
			rep(i,a.size()-1){
				b.push_back((a[i]+a[i+1])%10);
			}
			//rep(i,b.size())printf("%d ",b[i]);puts("");
			a=b;
		}
		
		printf("%d\n",a[0]);
	}
	
	
}