#include <cstdio>

int main()
{
        const int MAX = 10;
        char str[MAX+1];
        int num[MAX];

        while (scanf("%s", str) != EOF) {
                for (int i = 0; i < MAX; i++) {
                        num[i] = str[i] - '0';
                }
                for (int j = MAX - 1; j > 0; j--) {
                        for (int i = 0; i < j; i++) {
                                num[i] = (num[i] + num[i+1]) % 10;
                        }
                }
                printf("%d\n", num[0]);
        }
}