#include<iostream>
#include<string>
#include<vector>
int func(std::vector<int>&num)
{
	const size_t size = num.size();
	if (size == 1)
	{
		return num[0];
	}
	std::vector<int>result(size - 1);
	for (int i = 0; i < size - 1; i++)
	{
		result[i] = (num[i] + num[i + 1]) % 10;
	}
	return func(result);
}
int main()
{
	std::vector<int>num(10);
	while (true)
	{
		std::string num_str;
		std::cin >> num_str;
		if (std::cin.eof())
		{
			break;
		}
		for (int i = 0; i < 10; i++)
		{
			num[i] = static_cast<int>(num_str[i] - '0');
		}
		std::cout << func(num) << std::endl;
	}
	return 0;
}
