while 1: r=raw_input() k=s=9 while s:t=r.replace('?',`k`);s=sum(ord(c)%48%30*[i*10,33-i%2*22][len(r)/16]for i,c in enumerate(t[3:]))%110;k-=1 print t