#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

void apple(int a[], int b[], int c) {
	for (int i = 0; i < c; i++) {
		b[i] = (a[i] + a[i+1]) % 10;
	}

	return;
}


int main () {

	string std;
	int i[10];
	int j[10];

	while (cin >> std) {
		for (int k = 0; k < 10; k++) {
			i[k] = std[k] - '0';
		}

		apple(i,j,9);
		apple(j,i,8);
		apple(i,j,7);
		apple(j,i,6);
		apple(i,j,5);
		apple(j,i,4);
		apple(i,j,3);
		apple(j,i,2);
		apple(i,j,1);

		cout << j[0] << endl;
		
	}

	return 0;
}