#include <stdio.h>
int main() {int RideBack[10],i,j;char T[11];while (scanf("%s",&T)!=EOF) {for (i=0;i<10;RideBack[i]=T[i]-48,i++);for (j=0;j<=8;j++) for (i=9;i>0;i--) RideBack[i]=(RideBack[i]+RideBack[i-1])%10;printf("%d\n",RideBack[9]);}return 0;}