#include <iostream>
using namespace std;

string num;

int main(void){
  while(cin >> num){
    for(int i = num.length(); i > 1; i--){
      for(int j = 0; j < i - 1; j++){
        int sum = (num[j] - '0') + (num[j+1] - '0');
        int sub = sum - 10;
        if(sub >= 0){
          num[j] = sub + '0';
        }else{
          num[j] = sum + '0';
        }
      }
    }
    cout << num[0] << endl;
  }
  return 0;
}