#include <bits/stdc++.h>
using namespace std;

const int INF = 1e+9;

int main() {
	string s;
	while(cin >> s){
		vector<int> now;
		vector<int> next;
		next.resize(10);
		for(int i = 0; i < s.size(); ++i)
			now.push_back(s[i] - '0');
		for(int i = 0; i < 9; ++i){
			for(int j = 0; j < 10 - i - 1; ++j){
				next[j] = (now[j] + now[j + 1]) % 10;
			}
			now = next;
		}
		cout << now[0] << endl;
	}
	return 0;
}