#include<iostream>
#include<vector>
#include<string>
#include<sstream>

int main()
{
	static const std::string empty_string = "";

	for(;;)
	{
		std::vector<int> vec;

		std::string str;

		getline(std::cin,str);

		if(std::cin.eof())
		{
			break;
		}

		std::stringstream ss;

		int k;

		for(size_t i=0; i<str.length(); ++i)
		{
			ss << str[i];

			ss >> k;

			vec.push_back(k);
			
			ss.str(empty_string);

			ss.clear();
		}

		const int vecNum = vec.size();

		for(int i=0; i<vecNum-1; ++i)
		{
			for(size_t i=0; i<vec.size()-1; ++i)
			{
				vec[i] = (vec[i]+vec[i+1])%10;
			}

			vec.pop_back();
		}

		std::cout << vec[0] << '\n';
	}
}