#include <iostream>
#include <string>

using namespace std;

int main(void)
{
	string input;

	while( cin >> input ){
		int answer[10][10];
		for( int i = 0;i < 10;i++ ){
			for( int j = 0;j < 10;j++ ){
				answer[i][j] = 0;
			}
		}

		for( int i = 0;i < 10;i++ ){
			answer[0][i] = input[i] - '0';
		}

		for( int i = 9;i > 0;i-- ){
			for( int j = 0;j < i;j++ ){
				answer[10 - i][j] = answer[9 - i][j] + answer[9 - i][j + 1];
				int a = answer[10 - i][j];
				a /= 10;
				a *= 10;
				answer[10 - i][j] -= a;
			}
		}

		cout << answer[9][0] << endl;
	}
	return 0;
}