P13302 [CodeChef] arhn01
NOI
题目描述

Problem description.
An arithmetic progression(AP) is a sequence of numbers such that the difference of any two successive members of the sequence is a constant.
For example:- 1, 4, 7, 10,
13, 16, 19, ...
A geometric progression(GP) is a sequence of numbers where each term after the first is found by multiplying the previous one by a fixed non-zero
contant.
For examplee:- 1, 3, 9, 81, ... (with common ratio of 3).
Given three successive members of a sequence, you need to determine the type of the progression and the next successive member.

Input

Each case is specified on a single line with three integers a1, a2, a3 are distinct. The last case is followed by a line with three zeros.

Output

For each test case, your program must print a single line of the form:
XX v
where XX is either AP or GP depending if the given progression is an Arithmetic or
Geometric Progression. v is the next member of the given sequence. All input cases are guaranteed to be either an arithmetic or geometric progressions.

Constraints

Example
Input:
4 7 10
2 6 18
0 0 0
Output:
AP 13
GP 54

输入格式

见题面

输出格式

见题面

样例输入
4 7 10 2 6 18 0 0 0
样例输出
AP 13 GP 54