#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <map>
#include <fstream>
#include <array>
#include <utility>
#include <functional>
#include <stack>
#include <math.h>
#include <numeric>
#include <set>

using namespace std;
typedef long long Int;
#define REP(i , x) for(Int i = 0 ; i < x ; ++i)
typedef pair<int, int> P;


int main()
{
	Int n;
	while (cin >> n){
		vector<int> base(10);
		for (auto i = base.rbegin(); i != base.rend(); ++i){
			*i = n % 10;
			n /= 10;
		}

		REP(i, 9){
			vector<int> tmp(base.begin(), base.end());
			base.clear();
			REP(i, tmp.size() - 1){
				base.push_back((tmp[i] + tmp[i + 1]) % 10);
			}
		}
		cout << base[0] << endl;
	}
	return 0;
}