#include<iostream>
#include<string>
#define MAX 10
using namespace std;

int main(){
  string s;
  int ans[MAX], sum[MAX];
  while(cin >> s){
    for(int i=0; i<s.size(); i++){
     ans[i] = s[i] - '0'; 
    }
    int count=10;
    while(1){
      for(int i=0; i<count-1; i++){
	sum[i] = (ans[i] + ans[i+1]) % 10;
      }
      for(int i=0; i<MAX; i++){
	ans[i] = sum[i];
      }
      count--;
      if(count == 1) break;
    }
    cout << sum[0] << endl;
  }
}