x = input() def a(): if x[0] != '1': return -1 y = [x for x in x[1:] if x != '3'] print(y) if not y: return len(x)-1 return -1 print(a())