#include <cstdio>
using namespace std;


int a[10];
long n;

int main(){
	while (scanf("%ld", &n) != EOF)
	{
		for (int i = 9; i >= 0; i--) {
			a[i] = n % 10;
			n /= 10;
		}
		for (int i = 9; i > 0; i--) {
			for (int j = 0; j < i; j++) {
				a[j] = (a[j] + a[j + 1]) % 10;
			}
		}
		printf("%d\n", a[0]);
	}

	return 0;
}