Under construction

Still being built. Things may change

Who Has Seen the Wind

Interview

Time limit2sMemory limit512 MB

Summary
Given humidity h and a time limit M, evaluate the quartic altitude formula hour by hour and report the first hour the balloon's altitude drops to zero or below.
Level

Easy3 of 10

Topics
Math, Simulation, Brute force, Implementation
Solved
No attempts yet

Problem

Margaret has watched the wind drift over the prairies for a long time. From these observations she has built a formula that predicts the altitude of a weather balloon launched from her house. Specifically, the altitude AA (in metres above the ground) at hour tt after the launch is:

A=−6t4+ht3+2t2+tA = -6t^4 + h t^3 + 2t^2 + t

where hh is an integer humidity value between 00 and 100100 inclusive.

Margaret wants to know the earliest hour (if any) at which the balloon will hit the ground after launch, as long as it is no later than the maximum time MM she is willing to wait. The balloon is considered to touch the ground when A≤0A \le 0.

To find this, compute the altitude at t=1t = 1, t=2t = 2, …\dots until the balloon touches the ground or t=Mt = M is reached.

Input

Two non-negative integers are given: hh, the humidity factor, followed by MM, the maximum number of hours Margaret will wait for the balloon to return to the ground. You may assume 0≤h≤1000 \le h \le 100 and 0<M<2400 < M < 240.

Output

Print exactly one of the following on a single line:

  • The balloon does not touch ground in the given time.
  • The balloon first touches ground at hour: T

where TT is the positive integer representing the earliest hour at which the altitude is less than or equal to zero.

Examples2

  1. Example 1

    Input
    30
    10
    
    Expected output
    The balloon first touches ground at hour: 6
    
  2. Example 2

    Input
    70
    10
    
    Expected output
    The balloon does not touch ground in the given time.