#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a[10];
	
	while(scanf("%1d", &a[0])!=EOF){
		for(int i = 1; i < 10; i++){
			scanf("%1d", &a[i]);
		}
		for(int i = 9; i >= 0; i--){
			for(int j = 0; j < i; j++){
				a[j] = (a[j]+a[j+1])-((a[j]+a[j+1])/10)*10;
			}
		}
		cout << a[0] << endl;
	}
	
	return 0;
}