n = list(input()) n.pop(0) for x in n: if x != "3": print(-1) break else: print(len(n))