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

int main(){
	int triangle[10][10];
	long long int input;

	while(cin >> input){
		for(int i=0; i < 10; i++){
			triangle[0][9-i] = input % 10;
			input /= 10;
		}

		for(int i=1; i < 10; i++){
			for(int j=0; j < 10-i; j++){
				triangle[i][j] = (triangle[i-1][j] + triangle[i-1][j+1]) % 10;
			}
		}
		cout << triangle[9][0] << endl;
	}
}