get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

main:-
    get_number(K),
    get_number(A),
    get_number(B),
    X is A div K,
    Y is B div K,
    (A mod K =:= 0 ; B mod K =:= 0 ; X \= Y) -> writeln('OK') ; writeln('NG').
