#include <iostream>
using namespace std;

int main(){
	string s;int a[10];
	while(cin >> s){
		for(int i = 0;i < 10;i++)a[i] = s[i]-'0';
		for(int i = 9;i > 0;i--){
			for(int j = 0;j < i;j++){
				a[j] = (a[j] + a[j+1]) % 10;
			}
		}
		//for(int i = 0;i < 10;i++)cout << a[i] << " ";
		//cout << endl;
		cout << a[0] << endl;
	}
	return 0;
}