#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main() {
  char input[10];
  int field[9][9];
  
  while(scanf("%s", input) != EOF) {
    
    for(int i = 0 ; i < 9 ; i++) {
      field[8][i] = (input[i]-'0' + input[i+1]-'0') % 10;
    }

    for(int i = 7 ; i >= 0 ; i--) {
      for(int j = 0 ; j <= i ; j++) {
	field[i][j] = (field[i+1][j] + field[i+1][j+1]) % 10;
      }
    }
    /*for(int i = 8 ; i >= 0 ; i--) {
      for(int j = 0 ; j <= i ; j++) {
	printf("%d ", field[i][j]);
      }
      cout << endl;
      }*/
    cout << field[0][0] << endl;
  }
  return 0;
}