#include <iostream>
#include <vector>
using namespace std;
int main( void )
{
	while ( 1 )
	{
		char c;
		vector <int> a(10);
		vector <int> b(10);

		if ( !( cin >> c ) )
			break;
		a[0] = (int)(c-'0');
		for ( int i = 1; i < 10; i++ )
		{
			cin >> c;
			a[i] = (int)(c-'0');
		}

		for ( int i = 10; i > 1; i-- )
		{
			for ( int j = 0; j < i; j++ )
			{
				b[j] = ( a[j] + a[j+1] ) % 10;
			}
			a = b;
		}

		cout << a[0] << endl;

	}
	return 0;
}