#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif
 
int main(){
	std::string buf;
	std::vector<int> vec;
	std::vector<int> tmp;


#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif

#if INPUT_FROM_FILE
	while(std::getline(ifs, buf)){
#else
	while(std::getline(std::cin, buf)){
#endif
		vec.resize(buf.size(), 0);
		for(int i = 0; i < buf.size(); i++){
			vec[i] = buf[i] - '0';
		}

		while(vec.size() >= 2){
			tmp.resize(vec.size() - 1, 0);
			for(int i = 0; i < vec.size() - 1; i++){
				tmp[i] = (vec[i] + vec[i + 1]) % 10;
			}
			vec = tmp;
		}
		std::cout << vec[0] << std::endl;
	}
 

#if INPUT_FROM_FILE
	//fclose(fp);
#endif
    return 0;
}
