var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
for(var i=0;i<Arr.length;i++){
   var arr=Arr[i].split("").map(Number);
   while(arr.length!=1){
      var c=[];
      for(var j=0;j<arr.length-1;j++){
         var ab=arr[j]+arr[j+1];
         c.push(ab%10);
      }
      arr=c.slice();
   }
console.log(arr[0]);
}