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

using namespace std;

int main(){
  int i, j, n;
  string s;
  vector<int> number;

  while(cin >> s){
    for(i=0; i<s.size(); ++i){
      n = s[i] - 48;
      number.push_back(n);
    }

    for(i=number.size()-1; i>0; --i){
      for(j=0; j<i; j++){
	n = number[j] + number[j+1];
	if(n >= 10) n -= 10;
	number[j] = n;
      }
    }

    cout << number[0] << endl;
    number.clear();
  }

  return 0;
}