#include<stdio.h>
int dp[10]={0};

int main()
{
    char num;
    while(scanf(" %c",&num) != -1)
    {
        dp[0] = num-'0';
        for(int i = 1; i < 10; i++)
        {
            scanf(" %c",&num);
            dp[i] = num-'0';
        }
        for(int i = 9; i >= 1; i--)
        {
            for(int j = 0; j < i; j++)
            {
                dp[j] = (dp[j]+dp[j+1])%10;
            }
        }
        printf("%d\n",dp[0]);
        for(int i = 0; i < 10; i++)
        {
            dp[i] = 0;
        }
    }
    return 0;
}