#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;

void newarray(int *n, int length)
{
	for(int i=0; i<length; i++){
		n[i] = (n[i] + n[i+1]) % 10;
		cout << "n[i]=" << n[i] << endl;
	}
	cout << endl;
}


int main()
{
	int n[10];
	long long int in;

	cin >> in;
	long long int now = in;
	for(int i=9; i>0; i--){
		n[i] = now % 10;
		now = now / 10;
		if(i==1)	n[0] = now;
	}
	//分解end.

	for(int i=0; i<9; i++){
		newarray( n , (sizeof(n) / sizeof(n[0])));
	}

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