#include<iostream>
#include<string>
using namespace std;
int main() {
	int a[11], b[11], kazu;
	string m;
	kazu = 0;
	while (cin >> m) {
		for (int i = 1; i <= 10; i++) {
			a[i] = (int)m[i - 1] - '0';
		}
		for (int z = 9; z >= 1; z--) {
			for (int i = 1; i <= z; i++) {
				b[i] = a[i + 1] + a[i];
				b[i] = b[i] % 10;
			}
			for (int i = 1; i <= z; i++) {
				a[i] = b[i];
			}
		}
		cout << a[1] << endl;
	}
}
