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

int main() {
	vector<int> vi(10);
	vector<int> vii(10);
	string s;
	while (cin >> s) {
		for (int var = 0; var < s.length(); ++var) {
			vi[var] = s[var] - '0';
		}
		int cnt=10;
		while (1) {
			for (int var = 1; var < cnt; ++var) {
				vii[var - 1] = (vi[var - 1] + vi[var])%10;
				//cout<<vii[var - 1]<<endl;
			}
			if (cnt == 2) {
				cout << vii[0] << endl;
				vi= {0};
				break;
			}
			cnt--;
			vi= {0};
			for (int var = 1; var < cnt; ++var) {
				vi[var - 1] = (vii[var - 1] + vii[var])%10;
				//cout<<vi[var - 1]<<endl;
			}
			vii= {0};
			cnt--;
		}
	}
}