import sequtils,strutils,algorithm,math,future,macros template get*():string = stdin.readLine() #.strip() macro unpack*(arr: auto,cnt: static[int]): auto = let t = genSym(); result = quote do:(let `t` = `arr`;()) for i in 0.." .} macro scanints(cnt:static[int]): auto = var str = ""; for i in 0.." .} proc scan1[T](x:var T) :void = x = 0 var k:cint var minus = false while true: k = getchar_unlocked() if k == '-'.ord: (minus = true; break) if '0'.ord <= k and k <= '9'.ord: (x = k - '0'.ord; break) while true: k = getchar_unlocked() if k < '0'.ord or k > '9'.ord: break x = 10 * x + k - '0'.ord if minus : x *= -1 #template scan[T](xs:varargs[var T]):void = # for x in xs: scan(x) proc scan2[T](x,y:var T):void = (x.scan1;y.scan1) proc scan3[T](x,y,z:var T):void = (x.scan1;y.scan1;z.scan1) proc scan5[T](x,y,z,s,t:var T):void = (x.scan1;y.scan1;z.scan1;s.scan1;t.scan1) let (N,K) = get().split().map(parseInt).unpack(2) var field : array[-501..501,array[-501..501,int]] ene_XYHP : array[0..100_0001,array[3,int32]] for n in 0..