r=map(int,raw_input()) while r:print`r`[1::3];r=[abs(x-y)for x,y in zip(r[1:],r)]