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

int main (){
  char mp[11][11];

  while(cin >> mp[0]) {

    for(int i=1;i<10;i++) 
      for(int j=i;j<10;j++) {
	mp[i][j] = ((mp[i-1][j]-'0'+mp[i-1][j-1]-'0')%10)+'0';
	//cout <<mp[i][j] <<" "<< mp[i-1][j] <<" "<<mp[i-1][j-1] << endl;
      }
    cout << mp[9][9]<<endl;

  }

  return 0;
}