import Data.List

main = interact $ unlines . map (show . bfs) . parse . map (map read . words) . lines
 where
  parse [[0,0]] = []
  parse ([t,o]:xs) = (t, map (\[a,b]->(a,b)) os, (x,y)) : parse xs'
   where (os,([x,y]:xs')) = splitAt o xs

bfs (t,os,s@(sx,sy)) = length (bfs' 0 is [s])
 where
  is = [(x,y) | x<-[(sx-t)..(sx+t)], y<-[(sy-t)..(sy+t)]] \\ (s:os)
  bfs' t' is' rs'
   | t' == t = rs'
   | null is' = rs'
   | null is1 = rs'
   | otherwise = bfs' (t'+1) is2 (is1 ++ rs')
   where
    (is1,is2) = partition neighbor is'
    neighbor (xi,yi) = let ns = [(xi+1,yi),(xi-1,yi),(xi,yi+1),(xi,yi-1),(xi+1,yi+1),(xi-1,yi-1)] in (not.null) (intersect ns rs')