#isbn_in=['0-670-82162-4','0-670-82162-0']
isbn_in=[]
while True:
try:
isbn_in.append(input())
except EOFError:
break
def isbn(s):
sn=s.replace('-','')
key=0
for i in range(0,len(sn)-1):
key+=int(sn[i])*(i+1)
key=key%11
if key==10:
key="X"
else:
key=str(key)
return s[:-1]+key
for i in isbn_in:
if i==isbn(i):
print("Right")
else:
print(isbn(i))