Problem:
Score: 100 points

Problem 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.

Constraints

All values in input are integers.

1 \leq A \leq B \leq 1000

1 \leq K \leq 1000

Input

Input is given from Standard Input in the following format:

K
A B

Output

If he can achieve the objective, print OK; if he cannot, print NG.

Sample Input 1

7
500 600

Sample Output 1

OK

Among the multiples of 7, for example, 567 lies between 500 and 600.

Sample Input 2

4
5 7

Sample Output 2

NG

No multiple of 4 lies between 5 and 7.

Sample Input 3

1
11 11

Sample Output 3

OK

Solution in C (GCC 9.2.1) (judge verdict: Runtime Error)

#include <stdio.h>
int main(void){
    //変数定義
    int N;//N文字
    int M;//M種類
    int Q;//フィルターの数
    int point;//現在のポイント
    int maxpoint;//最大のポイント
    scanf("%d %d %d",&N,&M,&Q);//１行目入力
    int f[Q][4];//フィルター格納用配列、0~(Q-1)
    int l[N];//数列格納用配列、0~(N-1)
    //入力プログラム
    for(int i=0;i<Q;i++){//Q回繰り返す
    	scanf("%d %d %d %d",&f[i][0],&f[i][1],&f[i][2],&f[i][3]);//１行読み取り
    }
    //ループ＆数列作成
    //N文字の数列
    //初期化
    for(int i=0;i<N;i++){
    	l[i]=i;
    }
    while(l[0]!=M-N+1){
    	//点数計算処理
    	point = 0;
    	for(int i=0;i<Q;i++){//Q回繰り返す
    		if(l[f[i][1]]-l[f[i][0]]==f[i][2])
    			point += f[i][3];
    	}
    	if(maxpoint<=point)
          	maxpoint = point;
       	
    	//新規数列作成処理
    	//各n文字目について処理
    	for(int i=N-1;i>=0;i--){
    		if(i==N-1){
    			if(l[i]<M){//右端の数がMより小さいなら
    			l[i]++;
    			break;
    			}
    		}else{
    			if(l[i]<l[i+1]){//右端の数がMより小さいなら
           			l[i]++;
           			break;
           		}
           	}
    	}
    	
    	printf("%d",maxpoint);
    }
}