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

int main() {
	char ss[10];
	int a[10];
	while (cin >> ss) {
		for (int i = 0; i < 10; i++) {
			a[i] = ss[i] - '0';
		}
		int x = a[0] + a[9] + (a[1] + a[8]) * 9 + (a[2] + a[4] + a[5] + a[7]
			) * 6 + (a[3] + a[6]) * 4;
		string sa=to_string(x);
		reverse(sa.begin(), sa.end());
		cout << sa[0] << endl;
	}
	return 0;
}