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

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