#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

int main(){
  string s;

  while(cin >> s){

    int a[100],n = 10;
    for(int i=0;i<10;i++) a[i] = s[i] - 48;

    while(n > 0){

      for(int i=0;i<n-1;i++){
	if( a[i] + a[i + 1] > 9) a[i] += (a[i + 1] - 10);
	else a[i] += a[i + 1];
      }
      n--;
  
    }

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