import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); while(sc.hasNext()){ String s=sc.next(); int ans=Integer.MAX_VALUE; for(int i=0;i=3) ans=Math.min(ans,l); } } if(ans==Integer.MAX_VALUE) System.out.println(-1); else System.out.println(ans); } } }