data = [] for chunk in open("input").read().split("\n\n"): data.append([eval(x) for x in chunk.splitlines(False)]) def less(a, b): if type(a) == int and type(b) == int: return a < b if type(a) == list and type(b) == int: b = [b] elif type(a) == int and type(b) == list: a = [a] for x, y in zip(a,b): if less(x,y): return True elif less(y,x): return False return len(a)=") if less(a,b): t += i + 1 print(t) import functools def cmp(a, b): if less(a,b): return -1 if less(b,a): return 1 return 0 big = [e for x in data for e in x] big.append([[2]]) big.append([[6]]) big.sort(key=functools.cmp_to_key(cmp)) i1 = big.index([[2]]) + 1 i2 = big.index([[6]]) + 1 print(i1*i2)