n="" for d in`input()`: n+=d if int(n)%7<1:print n;n=""