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

int main()
{
	queue<int> list;
	int i, j;
	int a, b;
	char c;

	while ( ( c = cin.get() ) != EOF ) {
		while( !list.empty() )
			list.pop();
		list.push(c-'0');
		for (i = 1; i < 10; i++)
			list.push(cin.get()-'0');
		cin.ignore(0xFF, '\n');
		i = 1;
		j = 10;
		while (list.size() > 1) {
			a = list.front();
			list.pop();
			b = list.front();
			if (++i == j) {
				list.pop();
				i = 1;
				j--;
			}
			list.push( (a+b)%10 );
		}
		cout<<list.front()<<endl;
	}

	return 0;
}