using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace contest { class Program { static void Main(string[] args) { string E = Console.ReadLine(); int len = E.Length; int i = -1; if (E[0] == '1' && len >= 2) { int t; for (t = 1; t < E.Length; t++) { if (E[t] != '3') break; } if (t == E.Length) i = E.Length - 1; else i = -1; } Console.WriteLine(i); } } }