#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	string buffer;

	while ( cin >> buffer )
	{
		vector<int> line;

		for ( unsigned int i = 0; i < buffer.length(); i++ )
		{
			line.push_back( buffer[i] - '0' );
		}

		for ( unsigned int i = 0; i < 9; i++ )
		{
			for ( unsigned int j = 0; j + 1 < line.size(); j++ )
			{
				line[j] = ( line[j] + line[j+1] ) % 10;
			}
		}

		cout << line[0] << endl;
	}

	return 0;
}