#!/bin/python import sys n = int(raw_input().strip()) steps = {} def solve(n, i, j): steps = -1 visited = [] curr = [[(0,0)]] while curr: steps += 1 new = curr[0] curr = curr[1:] app = [] for pos in new: if pos == (n-1, n-1): return steps a = pos[0]+i b = pos[1]+j if (a,b) not in visited and a >=0 and b>=0 and a=0 and b>=0 and a=0 and b>=0 and a=0 and b>=0 and a=0 and b>=0 and a=0 and b>=0 and a=0 and b>=0 and a=0 and b>=0 and a