output_description: If he can achieve the objective, print `OK`; if he cannot, print `NG`.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      K
      A B
attempt: nmq = list(map(int, input().split()))
  N = nmq[0]
  M = nmq[1]
  Q = nmq[2]
  ablist = [list(map(int, input().split())) for i in range(Q)]
  sumlist = []
  alist = [i for i in range(1, M + 1)]
  import itertools as ite
  
  case = list(ite.combinations_with_replacement(alist, N))
  for nowcase in case:
      sumd = 0
      for i in range(Q):
          a = ablist[i][0]
          b = ablist[i][1]
          c = ablist[i][2]
          d = ablist[i][3]
          aa = nowcase[a - 1]
          ab = nowcase[b - 1]
          if ab - aa == c:
              sumd += d
      sumlist.append(sumd)
  print(max(sumlist))
  
problem_description: Statement
  
  Takahashi the Jumbo will practice golf.
  
  His objective is to get a carry distance that is a multiple of K, while he can
  only make a carry distance of between A and B (inclusive).
  
  If he can achieve the objective, print `OK`; if he cannot, print `NG`.
samples: [{"input": "7\n    500 600", "output": "OK\n    \n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\n* * *"}, {"input": "4\n    5 7", "output": "NG\n    \n\nNo multiple of 4 lies between 5 and 7.\n\n* * *"}, {"input": "1\n    11 11", "output": "OK"}]