#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>


using namespace std;

int main()
{
	char buf[11];
	while (scanf("%s\n", buf) != EOF)
	{
		int n[10];
		for (int i = 0; i < 10; ++i)
			n[i] = buf[i] - '0';

		for (int i = 9; i > 0; --i)
			for (int j = 0; j < i; ++j)
				n[j] = (n[j] + n[j+1]) % 10;

		printf("%d\n", n[0]);
	}
	
	return 0;
}