#include<iostream>
using namespace std;
int main() {
	char l[10];
	int a, b, c, d, e, f, g, h, i, j, k;
	while (cin >> l) {
		a = (int)l[0];
		b = (int)l[1];
		c = (int)l[2];
		d = (int)l[3];
		e = (int)l[4];
		f = (int)l[5];
		g = (int)l[6];
		h = (int)l[7];
		i = (int)l[8];
		j = (int)l[9];
		k = (a * 1 + b * 9 + c * 37 + d * 85 + e * 126 + f * 126 + g * 85 + h * 37 + i * 9 + j * 1) % 10;
		cout << k << endl;
	}
}