#include<iostream>
#include<vector>
#include<string>

int main()
{
	std::string s;
	while( std::cin >> s )
	{
		std::vector<int> v;
		for( int i = 0; i != 10; ++i )
			v.push_back( s[i] - '0' );

		std::vector<int> t;
		for( int i = 10; i >= 2; --i )
		{
			t.clear();

			for( int j = 0; j != i - 1; ++j )
				t.push_back( ( v[j] + v[j+1] ) % 10 );

			v = t;
		}

		std::cout << v[0] << std::endl;
	}

	return 0;
}