#t301. 极值问题(acme)

极值问题(acme)

Background

Special for beginners, ^_^

Extreme Value Problem

Problem Description

mm and nn are integers satisfying the following two conditions:

  • m,n∈{1,2,…,k}m, n \in \{1, 2, \dots, k\}, i.e. 1≤m,n≤k1 \le m, n \le k;
  • (n2−mn−m2)2=1(n^2 - mn - m^2)^2 = 1.

Your task: given a positive integer kk (1≤k≤1091 \le k \le 10^9), find a pair of m,nm, n satisfying the two conditions above such that m2+n2m^2 + n^2 is maximised. For example, if k=1995k = 1995 is entered from the keyboard, the output is:

m=987
n=1597

Input Format

One positive integer kk.

Output Format

Output 22 lines: the first line contains one integer, the value of mm; the second line contains one integer, the value of nn. The output format is exactly as in the sample, with no spaces in between.

Note: the lines m=987 and n=1597 must be printed exactly as shown — the judge compares them character by character, so do not change the letters or add/remove spaces.

Sample Input

1995

Sample Output

m=987
n=1597

Constraints

1s, 1024KiB for each test case.