import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;


public class Self {
	
	static List<int[]> navstiveno = new ArrayList<int[]>();

	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);

		while (sc.hasNextLine()) {
			
			int n = Integer.parseInt(sc.nextLine());				
						
			int[] poloha = {0, 0};
			
			int[][] smery = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
			
			navstiveno.clear();
			
			int smer = 0;
			
			boolean kolize = false;
			
			String radka = sc.nextLine();
			Scanner sc2 = new Scanner(radka);
			
			//System.out.println("pripad");
			
			for (int i = 0; i < n; i++) {				
				
				int a = sc2.nextInt();
				
				for (int j = 0; j < a; j++) {
					
					//System.out.println("smer" + Arrays.toString(smery[smer]));
					
					poloha[0] += smery[smer][0];
					poloha[1] += smery[smer][1];
					
					if (crash(poloha)) {
						System.out.println("" + i);
						kolize = true;
						break;
					}
					
					
					navstiveno.add(Arrays.copyOf(poloha, 2));
										
				}
				
				if (kolize) {
					break;
				}
				
				smer++;	
				if (smer == 4) {
					smer = 0;
				}
			}					
			
			//System.out.println(navstiveno);
			
			if (!kolize) {
				System.out.println("OK");
			}
		}

	}

	private static boolean crash(int[] poloha) {
		
		//System.out.print("Navstiveno: ");
		for (Object bod : navstiveno) {
			//System.out.println(Arrays.toString((int[]) bod));
		}
	
		//System.out.println("poloha " + Arrays.toString(poloha));
		
		for (Object bod : navstiveno) {
			int[] b = (int[]) bod;
			
			if (b[0] == poloha[0] && b[1] == poloha[1]) {
				return true;
			}			
		}
		
		return false;
	}
	
	

}
