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: import itertools
  
  N, M, Q = map(int, input().split())
  m = list()
  res = -100
  for i in range(Q):
      n = list(map(int, input().split()))
      m.append(n)
  l = [x for x in range(1, M + 1)]
  p = itertools.combinations_with_replacement(l, N)
  for p in p:
      total = 0
      for i in range(Q):
          num = 0
          a = m[i][0]
          b = m[i][1]
          A = p[a - 1]
          B = p[b - 1]
          C = B - A
          if m[i][2] == C:
              num = num + m[i][3]
              total = total + num
      if res < total:
          res = total
  print(res)
  
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"}]