This page is still under construction.

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

Minimum Final Exam Score

Time limit1sMemory limit256 MB

Summary
Given project, paper, and midterm scores, compute the smallest integer final score from 0 to 100 that lifts the weighted grade to 90, or report impossible.
Level

Easy2 of 10

Topics
Math
Solved
No attempts yet

Problem

You are about to take the final exam for Basket Weaving 101, and you want to know the lowest score on that exam that still leaves you with a course grade of at least 90. The course grade is a weighted average of four parts. The project counts for 15%, the term paper for 20%, the midterm exam for 25%, and the final exam for 40%.

Given the project score, the term paper score, and the midterm exam score, find the smallest integer final exam score that brings the course grade to 90 or above. A final exam score is an integer from 0 to 100. If no score in that range reaches a course grade of 90, print impossible.

In other words, with a project score pp, a term paper score ww, a midterm score mm, and a final exam score ff, find the smallest integer ff that satisfies 0.15p+0.20w+0.25m+0.40f≥900.15p + 0.20w + 0.25m + 0.40f \ge 90.

Input

The first line contains the number of test cases TT (1≤T≤10001 \le T \le 1000).

Each of the next TT lines contains the project score, the term paper score, and the midterm exam score, in that order. Every score is an integer from 0 to 100.

Output

For each test case, print on its own line the smallest integer final exam score that gives a course grade of at least 90. If no score from 0 to 100 reaches a course grade of 90, print impossible on that line instead.

Examples2

  1. Example 1

    Input
    3
    85 88 92
    70 95 65
    100 90 100
    
    Expected output
    92
    impossible
    80
    
  2. Example 2

    Input
    1
    85 88 92
    
    Expected output
    92