# Arup Guha
# 1/25/2025
# Solution to Kattis Problem: CPR Number
# https://open.kattis.com/problems/cprnummer

# My trick is putting 0 in slot 6, which matches up with the - in the
# number.
mult = [4,3,2,7,6,5,0,4,3,2,1]

# Get input as string.
s = input().strip()

# Calculate sum mod 11
val = 0
for i in range(len(s)):
    val = (val + mult[i]*(ord(s[i]) - ord('0')))%11

# Rules for CPR Number
if val == 0:
    print(1)
else:
    print(0)

           

