#include<iostream>

using namespace std;

int main(){

  int data[10][10];
  string in;

  while(cin >> in){

    for(int i = 0; i < 10; i++){
      data[0][i] = in[i] - 48;
      //cout << in[i] << " " <<data[0][i]<<" ";
    }
    // cout << endl;
    

    for(int i = 1; i < 10; i++){
      for(int j = 0; j < 10-i; j++){
	if(data[i-1][j] + data[i-1][j+1] >= 10){
	  data[i][j] = (data[i-1][j] + data[i-1][j+1]) % 10;
	}else{
	  data[i][j] = data[i-1][j] + data[i-1][j+1];
	}
      }
    }

    cout << data[9][0]<< endl;
  }

  return 0;

}