#include <iostream>
#include <vector>
using namespace std;

int main(){
	string s;
	vector<int> data;
	while(cin >> s){
		data.clear();
		for(int i=0;i<s.length();i++){
			data.push_back(s[i]-'0');
		}
		int n = 10;
		while(n != 1){
			vector<int> hoge;
			for(int i=0;i+1<n;i++){
				hoge.push_back((data[i]+data[i+1])%10);
			}
			data = hoge;	
			n--;
		}
		cout << data[0] << endl;
	}
}