#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main() {
  char input[20];
  int field[20][20];
  
  while(scanf("%s", input) != EOF) {
    memset(field, 0, sizeof(field));

    for(int i = 0 ; i < 9 ; i++) {
      field[0][i] = (input[i]-'0' + input[i+1]-'0') % 10;
    }
    
    for(int i = 1 ; i < 9 ; i++) {
      for(int j = 0 ; j <= 8-i ; j++) {
	if(j < 0) break;
	field[i][j] = (field[i-1][j] + field[i-1][j+1]) % 10;
      }
    }
    /*for(int i = 0 ; i < 9 ; i++) {
      for(int j = 0 ; j <= 8-i ; j++) {
      cout << field[i][j] << ' ';
	}
      cout << endl;
      }
    cout << endl;*/
    cout << field[8][0] << endl;
  }
  return 0;
}