#include <iostream>

using namespace std;
/** Problem0062 : What is Bottommost? **/
int main()
{
	int array1[10], array2[10];
	char c;
	while (1) {
		for (int i=0; i<10; i++) {
			cin >> c;
			array1[i] = c - '0';
		}
		if (cin.eof()) break;
		
		for (int i=1; i<10; i++) {
			for (int j=i; j<10; j++) {
				if (i%2==1) {
					array2[j] = (array1[j-1]+array1[j])%10;
				} else {
					array1[j] = (array2[j-1]+array2[j])%10;
				}
			}
		}
		cout << array2[9] << endl;
	}
	return 0;
}