#define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 30
int main(void)
{
	char num[11],a;
	int n[10];
	while (gets_s(num, 11) != NULL) {
		for (int i = 0; num[i] != '\0'; ++i) {
			a = num[i];
			sscanf_s(&a, "%d", &n[i]);
		}
		for (int i = 10; i >= 1; --i) {
			for (int j = 0; j < i - 1; ++j) {
				n[j] = (n[j] + n[j + 1]) % 10;
			}
		}
		printf("%d\n", n[0]);
	}
}