This page is still under construction.

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

Cabin Baggage

Time limit1sMemory limit128 MB

Summary
Decide for each bag whether it meets the size and weight limits, print 1 or 0 per bag, then print the total count.
Level

Easy1 of 10

Topics
Implementation
Solved
No attempts yet

Problem

Cabin baggage is a bag that a passenger may bring into the cabin. It is also called carry on or hand baggage. For safety, cabin baggage must not be too heavy or too big. Each airline sets its own size and weight limits for cabin baggage, following the IATA (International Air Transport Association) guidelines.

ICPC Airline uses the limits below. The size check passes when at least one of the following two conditions holds.

  • The length is at most 56 cm, the width is at most 45 cm, and the depth is at most 25 cm.
  • The sum of the three sides (length + width + depth) is at most 125 cm.

The weight must not exceed 7 kg. Only a bag that passes both the size check and the weight check may go into the cabin. Every limit includes its boundary, so a measurement exactly equal to a limit is allowed.

The airline measures each bag with a high precision laser device. The device reports the length (cm), the width (cm), the depth (cm) and the weight (kg) as four positive numbers with two decimal places.

Write a program that decides, for each bag, whether it may go into the cabin.

Input

The first line contains the number of bags to check, tt (1≤t≤3001 \le t \le 300).

Each of the next tt lines contains the measurements of one bag: the length, the width, the depth and the weight, in that order. All four values are positive numbers with two decimal places.

Output

For each bag, print 1 on its own line if it may go into the cabin and 0 otherwise. On the last line, print how many bags may go into the cabin.

Examples2

  1. Example 1

    Input
    4
    51.23 40.12 21.20 3.45
    60.00 30.00 20.00 7.00
    52.03 41.25 23.50 7.01
    50.00 45.00 30.10 6.02
    
    Expected output
    1
    1
    0
    0
    2
    
  2. Example 2

    Input
    3
    51.23 40.12 21.20 3.45
    60.00 30.00 20.00 7.00
    52.03 41.25 23.50 7.01
    
    Expected output
    1
    1
    0
    2