def my_ID():
IDcode1=input()
IDcode=IDcode1.replace("x","X")
if not(len(IDcode)==18):
print("Error!")
return 0
b=["1","2","3","4","5","6","7","8","9","0","X"]
for i in IDcode:
if not(i in b):
print("Error!")
return 0
c=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2]
a=0
sum=0
for i in IDcode[:17]:
for d in c[a:a+1]:
sum=sum+(d*int(i))
a=a+1
e=sum%11
f="10X98765432"
if not(f[e:e+1]==IDcode[-1:]):
print("Error!")
return 0
else:
print("OK!")
return 0
my_ID()
while my_ID()==0:
my_ID()