import sys for a in sys.argv[1:]:print(a+"0123456789X"[sum(int(a.replace("-","")[i])*(i+1)for i in range(9))%11])