#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define pb push_back
#define mp make_pair
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

string line;

int main()
{
	while (cin >> line)
	{
		while (line.length() != 1)
		{
			for (int i=0; i<line.length()-1; i++)
			{
				line[i] = ((line[i]-'0') + (line[i+1]-'0')) % 10 + '0';
			}
			line = line.substr(0, line.length()-1);
		}
		cout << line << endl;
	}

	return 0;
}