Under construction

Still being built. Things may change

Falling Mugs

Time limit1sMemory limit256 MB

Summary
Given D, find nonnegative integers n1 and n2 with n2 squared minus n1 squared equal to D, smallest n1 first, or report impossible.
Level

Easy3 of 10

Topics
Number theory, Math
Solved
No attempts yet

Problem

Susan films falling coffee mugs with a high speed camera. She wants to know how tall the mugs are, but every mug broke during filming, so the video is all she has left.

The camera records 70 frames per second. Count frames from the moment the mug is released, so the release itself is frame 0. By frame nn the mug has fallen exactly n2n^2 millimeters.

Susan believes one mug is DD millimeters tall. To check that, she needs two frames n1n_1 and n2n_2 between which the mug fell exactly DD millimeters, that is, two frames with n22−n12=Dn_2^2 - n_1^2 = D.

Input

The first and only line contains the distance DD to be measured, in millimeters (1≤D≤2000001 \le D \le 200000).

Output

Print two non-negative integers n1n_1 and n2n_2 on one line, separated by a space, with n22−n12=Dn_2^2 - n_1^2 = D.

Several pairs can satisfy the equation. In that case print the lexicographically smallest pair, which is the pair with the smallest n1n_1. If no such pair exists, print impossible.

Examples2

  1. Example 1

    Input
    88
    
    Expected output
    9 13
    
  2. Example 2

    Input
    86
    
    Expected output
    impossible