#include <iostream>

using namespace std;

int main()
{
	char buf[11];
	while ( cin >> buf ) {
		for (int i=0; i<10; i++) buf[i] -= '0';
		for (int i=9; i>0; i--) {
			for (int j=0; j<=i; j++) buf[j] = (buf[j] + buf[j+1]) % 10;
		}
		cout << static_cast<int>(buf[0]) << endl;
	}
	
	return 0;
}