This page is still under construction.

Parts of this page are still being built. What you see may change.

Score Tally

Time limit1sMemory limit128 MB

Summary
Drop the highest and lowest of five judge scores, print KIN when the remaining three span 4 or more, else print their sum.
Level

Easy1 of 10

Topics
Sorting, Implementation
Solved
No attempts yet

Problem

The Korean Gymnastics Association is changing how it tallies scores so that one bad call counts for less. Under the old rule, five judges each give an integer score from 1 to 10, one highest score and one lowest score are dropped, and the sum of the remaining three is the total. Under the new rule, if the highest and the lowest of those three remaining scores differ by 4 or more, the scores are adjusted and the routine is judged again.

Write a program that tallies the scores and prints the total, or prints KIN (Keep In Negotiation) instead of the total when the scores have to be adjusted and given again.

Input

The first line has the number of test cases TT (1≤T≤101 \le T \le 10).

Each of the next TT lines has the five integer scores NiN_i (1≤Ni≤101 \le N_i \le 10, i=1,2,…,5i = 1, 2, \dots, 5) given by the five judges, separated by single spaces.

Output

For each test case, print the total on its own line. If the scores have to be adjusted and given again, print KIN instead of the total.

Examples2

  1. Example 1

    Input
    4
    10 8 5 7 9
    10 9 10 9 5
    10 3 5 9 10
    1 2 3 6 9
    
    Expected output
    24
    28
    KIN
    KIN
  2. Example 2

    Input
    2
    4 4 4 4 4
    2 2 6 10 10
    
    Expected output
    12
    KIN