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

int main(){
	string s;
	int a[ 10 ];
	while ( cin >> s ){
		for ( int i = 0; i < 10; ++i ){
			a[ i ] = static_cast< int >( s[ i ] - '0' );
		}

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

		cout << a[ 0 ] << endl;
	}
	return 0;
}