#include <iostream>
#include <algorithm>
#include <vector>
#include <climits>
#include <cfloat>
#include <cmath>
#include <string>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) (v).begin(),(v).end()
#define INF INT_MAX
#define BINF DBL_MAX

int main(){
	string s;
	while (cin >> s){
		int x[11][11] = {};
		rep(i, 10) x[0][i] = s[i] - '0';
		for (int i = 1; i < 10; i++){
			for (int j = 0; j < 10 - i; j++){
				x[i][j] = (x[i - 1][j] + x[i - 1][j + 1]) % 10;
			}
		}
		cout << x[9][0] << endl;
	}
	return 0;
}