#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

int main()
{
	string s;
	for (; cin >> s;)
	{
		vector<int> a;
		for (int i = 0; i < s.length(); i++)
		{
			a.push_back(atoi(s.substr(i, 1).c_str()));
		}

		
		for (; a.size() > 1;)
		{
			vector<int> b;
			for (int i = 1; i < a.size(); i++)
			{
				int x = (a.at(i - 1) + a.at(i)) % 10;
				b.push_back(x);
			}

			a = b;
		}

		cout << a.back() << endl;
	}
}
