Under construction

Still being built. Things may change

Cargo Ship

Time limit1sMemory limit1024 MB

Summary
Given a deck of a by b meters and cars of c by d meters, decide whether all n cars fit, and if not, find the maximum that do.
Level

Easy2 of 10

Topics
Implementation, Math
Solved
No attempts yet

Problem

Kostas is the captain of a cargo ship that carries cars across the sea. The ship's cargo deck is a rectangle a meters long and b meters wide. On each trip, the captain carries cars of only one brand, and all of those cars have the same width and the same length.

A customer asked Kostas to ship n cars, each c meters long and d meters wide.

Help Kostas determine whether all the cars fit on the ship. Cars are loaded in rows. All rows must run either along the length of the deck or across its width, not a mix of both. Within a row, all cars face the same direction.

Input

The first line contains two integers a, the length of the cargo deck, and b, the width of the deck.

The second line contains two integers c, the length of one car, and d, the width of one car.

The third line contains one integer, the number of cars to ship.

Output

If all the cars fit on the ship, print TAIP. Otherwise, print the maximum number of cars that can fit on the ship.

Constraints

1 ≤ a, b, c, d ≤ 1000

n ≤ 100 000

Examples3

  1. Example 1

    Input
    11 8
    10 4
    2
    
    Expected output
    TAIP
    
  2. Example 2

    Input
    9 6
    5 3
    3
    
    Expected output
    TAIP
    
  3. Example 3

    Input
    12 9
    5 4
    6
    
    Expected output
    5