while True:
try:
isbn = input().split('-')
isbn_str = ''.join(isbn)
total = 0
for i in range(len(isbn_str)-1):
total += (i+1)*int(isbn_str[i])
chk = 'X' if total%11 == 10 else str(total%11)
if chk == isbn_str[-1]:
print('Right')
else:
for i in range(len(isbn)-1):
print(isbn[i],end='-')
print(chk)
except EOFError:
break