#include <stdio.h>
#include <stdlib.h>

int main() {
    int a, b;

    scanf("%d\n\r", &a);

    b = (abs(a) % 10); //取绝对值考虑复数的输入

    printf("%d\n\r", b);

    return 0;
}