#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef pair<int, int> pii;

int main()
{
	char str[16];
	while(scanf("%16s", str) != EOF){
		int a[10];
		rep(i, 10) a[i] = str[i] - '0';

		rep(i, 9){
			rep(j, 9-i){
				a[j] = (a[j] + a[j+1]) % 10;
			}
		}

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

	return 0;
}