P13077 [HackerEarth] fare evaluator 2
普及
题目描述

Statement: Sourav and his friends are in kolkata city and they are
planning for a city tour. So, they booked a TUBER cab
(Stop Giggling). Please help them to find the estimated fare
according to the fare evaluator system of TUBER cabs.

How to evaluate fare?
For first 2 Kilometers, Fare is 50 units (i.e., Base Charge or Minimum Charge).
For more than 2 Kilometers, Fare is 12 units/Kilometer (except first 2 Kilometers).
Waiting charge is 2 units/min.
Maximum distance travelled by cab services is 60 Kilometers.

Input: First line of input containts T, i.e., number of test
cases, followed by T lines each containing-
Total distance, D
Waiting time, WT (in minutes)

D & WT are space seperated values on each line.

Output: T lines each containing estimated fare. If D exceeds
maximum distance travel value, print NA.

Constraints: 1 ≤ T ≤ 100 | 1 ≤ D ≤ 60 | 1 ≤ WT ≤ 250

SAMPLE INPUT
3
5 2
12 0
61 3

SAMPLE OUTPUT
90
170
NA

Explanation

In the above sample input,
For the 1st case, D=5 and WT=2, so estimated fare is 90 units.
For the 3rd case, D=61 and WT=3, since TUBER cabs do not travel beyond 60 kilometers, so output is NA.

输入格式

见题面

输出格式

见题面

样例输入
3 5 2 12 0 61 3 SAMPLE
样例输出
90 170 NA