"""
The game mode is: REVERSE. You do not have access to the statement.
Test 1 -
Provided Input
0
Expected Output
0
Test 2 -
Provided Input
44
Expected Output
4
Test 3 -
Provided Input
179
Expected Output
9
Test 4 -
Provided Input
3254
Expected Output
4
Test 5 -
Provided Input
9001
Expected Output
1
Test 6 -
Provided Input
9
Expected Output
9
Test 7 -
Provided Input
10
Expected Output
0
Test 8 -
Provided Input
15
Expected Output
5
Test 9 -
Provided Input
22
Expected Output
2
Test 10 -
Provided Input
30
Expected Output
0
"""
print raw_input()[-1]
