#include<bits/stdc++.h>
using namespace std;
int main(){
  long long c;
  int mas[11][11];
  while(cin>>c){
    memset(mas,0,sizeof(mas));
    //cout<<c<<endl;
    for(int i=0;i<10;i++){
      mas[0][i] = c % 10;
      c /= 10;
    }
    
    for(int i=1;i<10;i++){
      for(int j=0;j<10;j++){
	mas[i][j] = (mas[i-1][j] + mas[i-1][j+1]) % 10;
	//cout<<mas[i][j]<<" ";
      }
      //cout<<endl;
    }
    
    cout<<mas[9][0]<<endl;
  }
}