#include <bits/stdc++.h>
#define range(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) range(i,0,n)
using namespace std;

int main(void){
	while(1){
		string num;
		cin >> num;
		if(cin.eof())break;
		int ans=0;
		int coef=1;
		rep(i,num.size()){
			ans+=coef*(num[i]-'0');
			coef*=(9-i);
			coef/=(1+i);
		}
		cout << ans%10 << endl;
	}
	return 0;
}