#include<iostream>
using namespace std;
int main(){
  string s;
  while(cin >>s){
    int log[10];
    for(int i=0; i<10; i++) log[i] = s[i]-'0';
    for(int i=0; i<9; i++){
      for(int j=0; j<9-i; j++) log[j] = (log[j]+log[j+1])%10;
      for(int j=9-i; j<10; j++) log[j] = 0;
    }
    cout <<log[0]<<endl;
  }
  return 0;
}