#include <iostream>
#include <string>
using namespace std;

int c2i(char c){return c - '0';}

string str;
int dp[10][10];

void solve() {
	for (int i = 0; i < 10; i++) {
		dp[0][i] = c2i(str[i]);
	}

	for (int i = 1; i < 10; i++) {
		for (int j = 0; j < 10 - i; j++) {
			dp[i][j] = (dp[i-1][j] + dp[i-1][j+1]) % 10;
		}
	}

	cout<<dp[9][0]<<endl;
}

int main(int argc, const char *argv[]) {
	while (cin>>str) {
		solve();
	}
	return 0;
}