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

int main()
{
  char number;
  int n[10];
  int i,j;

  while(scanf("\n%c",&number)!=EOF){
    n[0]=number-'0';
    for(i=1;i<10;i++){
      scanf("%c",&number);
      n[i]=number-'0';
    }
    for(i=1;i<10;i++)
      for(j=0;j<10-i;j++)
	n[j]=(n[j]+n[j+1])%10;

    cout<<n[0]<<endl;
  }
}