import Foundation let s = readLine()! if s.count <= 1 { print(-1) exit(0) } if s.prefix(1) != "1" { print(-1) exit(0) } if s.suffix(s.count - 1).first(where: { $0 != "3" }) != nil { print(-1) exit(0) } print(s.count - 1)