Problem:


Score : 300 points

Problem Statement

You are given an integer N.

Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.

If there are multiple solutions, any of them will be accepted.

Constraints

It is guaranteed that, for the given integer N, there exists a solution such that h,n,w \leq 3500.

Inputs

Input is given from Standard Input in the following format:

N

Outputs

Print a triple of positive integers h, n and w that satisfies the condition, in the following format:

h n w

Sample Input 1

2

Sample Output 1

1 2 2

4/2 = 1/1 + 1/2 + 1/2.

Sample Input 2

3485

Sample Output 2

872 1012974 1539173474040

It is allowed to use an integer exceeding 3500 in a solution.

Sample Input 3

4664

Sample Output 3

3498 3498 3498



Sample input:
2


Sample output:
1 2 2

Submission status: Accepted

Solution code:
def c_4_over_n(N):
    for h in range(1, 3501):
        for n in range(1, h + 1):
            # 条件式をwについて整理したときの分子と分母
            numerator = N * h * n
            denominator = 4 * h * n - N * n - N * h
            # このときwが正整数になる
            if denominator > 0 and numerator % denominator == 0:
                w = numerator // denominator
                # 分母の値が小さなもの順に表示する(趣味)
                ans = '{0} {1} {2}'.format(*sorted([h, n, w]))
                return ans
    return None

N = int(input())
print(c_4_over_n(N))

Submission status: Accepted

Solution code:
N = int(input())

w = -1
flg = False
for h in range(1, 3500 + 1):
    for n in range(h, 3500 + 1):
        q = 4 * n * h - N * (n + h)
        #print(h, n, p, q)
        if q > 0:
            #q == 0: 1/wなしで4/Nに等しくなり不適（w無限大）
            #q < 0: p > 0より、w < 0となり不適
            p = N * n * h
            if p % q == 0:
                w = p // q
                flg = True
                break
    if flg:
        break
print(h, n, w)

Submission status: Accepted

Solution code:
n = int(input())
flag = False
for i in range(1,3501):
	for j in range(i,3501):
		if (4*i*j-i*n-j*n)>0 and (n*i*j)%(4*i*j-i*n-j*n)==0:
			a,b,c,flag = i,j,(n*i*j)//(4*i*j-i*n-j*n),True
			break
	if flag: break
print(a,b,c)

Submission status: Accepted

Solution code:
n=int(input())
for k in range(1,3501):
    for j in range(1,k+2):
        a=(4*j*k - n*k- n*j)
        if a<=0 : continue
        i = n*j*k / a
        i2= n*j*k // a
        if i==i2 :
            print(i2,j,k)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
N = int(input())

def solve():
    for h in range(1, 3501):
        for w in range(h, 3501):
            a = N * h * w
            b = 4 * h * w - N * h - N * w
            if b < 1:
                continue
            n = a / b
            if n == int(n):
                print(h, int(n), w)
                return

solve()

Submission status: Accepted

Solution code:
import sys
N = int(input())

for h in range(1, 3501):
	for n in range(h, 3501):
		if 4*h*n>N*(n+h):
			w=(N*h*n)/(4*h*n-N*(n+h))
			if w==int(w):
				w=int(w)
				print(h,n,w)
				sys.exit()

Submission status: Accepted

Solution code:
def gcd(x, y):
    while y!=0:
        x, y = y, x%y
    return x

def process():
    n = int(raw_input().strip())
    if n%2 == 0:
        print str(n)+' '+str(n)+' '+str(n>>1)
        return
    for x in xrange(max(n>>1, 1), 3501):
        for y in xrange(x, 3501):
            b = n*x*y
            a = 4*x*y-n*x-n*y
            if a>0 and (b%a)==0:
                print str(x)+' '+str(y)+' '+str(b/a)
                return

process()

Submission status: Accepted

Solution code:
N=int(input())
for n in range(1,3501):
    for w in range(1,3501):
        if n*(4*w-N)-N*w==0:
            continue
        if N*n*w % (n*(4*w-N)-N*w) ==0:
            h= (N*n*w) // (n*(4*w-N)-N*w)
            if h>=1:
                print(h,n,w)
                exit()

Submission status: Accepted

Solution code:
N = int(input())
flag = False
for i in range(1,3500):
    for j in range(1,3500):
        if((4*i*j - N*i - N*j) > 0 and (N*i*j)%(4*i*j - N*i - N*j) == 0):
            w = int((N*i*j)/(4*i*j - N*i - N*j))
            h = i
            n = j
            flag = True
            break
    if flag:
        break

print(h,n,w)

Submission status: Accepted

Solution code:
N = int(input())
def calc(N):
    for h in range(1, 3500):
        for n in range(1, 3500):
            if 4 * h * n - N * n - N * h > 0 and (N * h * n) % (4 * h * n - N * n - N * h) == 0:
                w = (N * h * n) / (4 * h * n - N * n - N * h)
                return h, n, int(w)
print('{0[0]} {0[1]} {0[2]}'.format(calc(N)))

Submission status: Accepted

Solution code:
def solver():
    N = int(raw_input())

    for h in xrange(1, 3501):
        for n in xrange(1, 3501):
            x = N * h * n;
            y = 4 * n * h - N * n - N * h;
            if y > 0 and x % y == 0:
                w = x / y
                return map(str, [h, n, w])


print " ".join(solver())

Submission status: Accepted

Solution code:
def solve(n):
    for a in range(1,3501):
        for b in range(1,3501):
            num = n * a * b
            deno = 4 * a * b - n * a - n * b
            if deno > 0 and num >= deno and num % deno == 0:
                c = num / deno
                print a,b,c
                return
    print 'NotFound!'
    return

n = int(raw_input())
solve(n)

Submission status: Accepted

Solution code:
import sys
N = int(input())
for i in range(1,3501):
    for j in range(i,3501):

        if 4*i*j-N*i-N*j > 0:
            if (N*i*j)%(4*i*j-N*i-N*j) == 0:
                w = int((N*i*j)/(4*i*j-N*i-N*j))
                print(i,j,w)
                sys.exit()

Submission status: Accepted

Solution code:
import sys
N=int(input())
for h in range(1,3501):
    for n in range(h,3501):
        if 4*n*h-N*h-N*n >0:
            if (N*h*n)%(4*n*h-N*h-N*n)==0:
                w=int((N*h*n)/(4*n*h-N*h-N*n))
                print(h,n,w)
                sys.exit()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    for h1 in range(3500):
        h = h1 + 1
        for w1 in range(h):
            w = w1 + 1
            if (4*h*w-n*h-n*w) <= 0: continue
            aint = n*w*h//(4*h*w-n*h-n*w)
            a = n*w*h/(4*h*w-n*h-n*w)
            if aint == a:
                print(h, w, aint)
                return 0

main()

Submission status: Accepted

Solution code:
N = int(input())


for a in range(1,3501):
    for b in range(1,3501):
        if (4*a*b - a*N - b*N) > 0:
            c = (a*b*N) // (4*a*b - a*N - b*N)
        else:
            continue
        if c != 0 and 4/N == (1/a + 1/b + 1/c):
            print(a,b,c)
            exit()

Submission status: Accepted

Solution code:

def main():
    N = int(input())

    for h in range(1,3501):
        for n in range(1,3501):
            x = 4*h*n - N*n -N*h
            if x <= 0:
                continue
            w, mod = divmod(N*h*n, x)
            if not mod:
                print(h, n, w)
                return

main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
 
    for h in range(1, 3501):
        for n in range(1, 3501):
            x = 4 * h * n - N * n - N * h
            if x <= 0: continue
            w, mod_ = divmod(N * h * n, x)
            if not mod_:
                print(h, n, w)
                return
 
main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())

    for h in range(1, 3501):
        for n in range(1, 3501):
            x = 4 * h * n - N * n - N * h
            if x <= 0: continue
            w, mod_ = divmod(N * h * n, x)
            if not mod_:
                print(h, n, w)
                return

main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())

    for h in range(1, 3501):
        for n in range(1, 3501):
            x = 4 * h * n - N * n - N * h
            if x <= 0: continue
            w, mod_ = divmod(N * h * n, x)
            if not mod_ and w > 0:
                print(h, n, w)
                return

main()

Submission status: Accepted

Solution code:
N = int(input())
i = 1
while i<=7000:
    if N/i >= 4:
        i += 100
        continue
    if i >100:
        i -= 100
    for x in range(i,3501):
        for y in range(i,3501):
            a = (4*x*y - N*y - N*x)
            if a == 0:
                continue
            z = N*x*y/a
            if z == int(z) and z >= 1:
                print(x,y,int(z))
                exit()

Submission status: Accepted

Solution code:
class EndLoop(Exception):
    pass
 
 
def solve():
    N = int(input())
 
    try:
        for h in range(1, 3500):
            for n in range(1, 3500):
                if 4 * h * n - n * N - h * N == 0:
                    pass
                elif (h * n * N) % (4 * h * n - n * N - h * N) == 0 and\
                            (4 * h * n - n * N - h * N) > 0:
                    w = (h * n * N) / (4 * h * n - n * N - h * N)
                    print(h, n, int(w))
                    raise EndLoop
    except(EndLoop):
        pass
 
 
solve()

Submission status: Accepted

Solution code:
class EndLoop(Exception):
    pass


def solve():
    N = int(input())
    try:
        for h in range(1, 3501):
            for n in range(1, 3501):
                if 4 * h * n - n * N - h * N > 0:
                    if (h * n * N) % (4 * h * n - n * N - h * N) == 0:
                        w = int((h * n * N) / (4 * h * n - n * N - h * N))
                        print(h, n, int(w))
                        raise EndLoop
    except:
        pass


solve()

Submission status: Accepted

Solution code:
N = int(input())
for h in range(1, 3501):
    for n in range(h, 3501):
        a = 4 * h * n - h * N - n * N
        if a == 0:
            break
        w = int((h * n * N) / a)
        if w > 0 and 4 / N == 1 / h + 1 / n + 1 / w:
            print(h, n, w)
            exit()

Submission status: Accepted

Solution code:
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        a = 4 * h * n - h * N - n * N
        if a == 0:
            break
        w = int((h * n * N) / a)
        if w > 0 and 4 / N == 1 / h + 1 / n + 1 / w:
            print(h, n, w)
            exit()

Submission status: Accepted

Solution code:
N = int(input())
for a in range(1, 3501):
    for b in range(a+1, 3501):
        c2 = 4 * a * b - b * N - a * N
        if c2 <= 0:continue
        c1 = a * b * N
        if c1/c2 == c1//c2:
            print(a,b,c1//c2)
            exit()

Submission status: Accepted

Solution code:
#!usr/bim/python
#! -*- coding: utf-8 -*-
import math

nyu = raw_input()
nyu = int(nyu)

h = 0
n = 0
w = 0

if nyu % 2 == 0:
    h = nyu
    n = nyu
    w = nyu / 2

elif nyu % 4 == 1:
    h = nyu / 4.0
    h = math.ceil(h)
    h = int(h)
    i = 0
    status = 0
    while 1:
        x = nyu*h
        y = 4*i+3
        for j in range(y/2):
            if j == 0:
                if x % y == 0:
                    n = x*2/y
                    w = x*2/y
                    status = 1
                    break
            else:
                if x % (j*(y-j)) == 0:
                    n = x/(y-j)
                    w = x/j
                    status = 1
                    break
        if status == 1:
            break
        else:
            i += 1
            h += 1

else:
    h = nyu / 4.0
    h = math.ceil(h)
    h = int(h)
    n = nyu*h*2
    w = nyu*h*2

print h,n,w

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
http://tenka1-2017-beginner.contest.atcoder.jp/tasks/tenka1_2017_c

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    N = int(input())

    found = False
    for h in range(1, 3500+1):
        if found:
            break
        for n in range(1, h+1):
            try:
                w = h*n / (4*h*n/N - n - h)
            except ZeroDivisionError:
                continue
            if w > 0 and w == int(w):
                print(h, n, int(w))
                found = True
                break


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
N=int(input())

if N%2==0:
    print(N,N,int(N/2))
    quit()

for i in range(1,3501):
    for j in range(1,3501):
        if(4*i*j-N*(i+j)<=0):continue
        n=N*i*j/(4*i*j-N*(i+j))
        if(n==int(n)):
            print(i,j,int(n))
            quit()


quit()

Submission status: Accepted

Solution code:
N = int(raw_input())

for h in range(1,3500):
  for w in range(h,3500):
    if (4*h*w-N*w-N*h) < 1:
      continue
    if (N*h*w % (4*h*w-N*w-N*h)) == 0:
      print h,w,(N*h*w / (4*h*w-N*w-N*h))
      exit(0)

Submission status: Accepted

Solution code:
def i1():
    return int(input())
def i2():
     return [int(i) for i in input().split()]

n=i1()
def a():
    for i in range(1,3501):
     for j in range(1,3501):
            x=4*i*j-i*n-j*n
            if x>0 and (n*j*i)%x==0:
                print(i,j,int((n*j*i)/x))
                return 0
a()

Submission status: Accepted

Solution code:
import sys
N = int(input())
for h in range(1,3501):
    for n in range(1,3501):
        if 4*n*h > N*n + N*h and (N*n*h) % (4*n*h-N*h-N*n) == 0:
            w =  (N*n*h) // (4*n*h-N*h-N*n)
            print(n,h,w)
            sys.exit()

Submission status: Accepted

Solution code:
import math

N = int(input())

if N%2 == 0:
    print(N, N, N//2)
    
else:
    flag = False
    
    for h in range(1, 3501):
        if flag == True:
            break
        
        for n in range(1, 3501):
            if flag == True:
                break
            
            if ((n*(h*4-N)-N*h) > 0) and (N*h*n)%(n*(h*4-N)-N*h) == 0:
                print(h, n, (N*h*n)//(n*(h*4-N)-N*h))
                flag = True

Submission status: Accepted

Solution code:
import sys
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        if  4*h*n > N*n + N*h and  (N*h*n) % (4*h*n - N*n - N*h) == 0:
            print(str(h) + " " + str(n) + " " + str((N*h*n)//(4*h*n - N*n - N*h) ))
            sys.exit()

Submission status: Accepted

Solution code:
n=int(input())
a=1
b=1
c=1
z=0
while a<=3500:
    b=a
    if z==1:
        break
    while b<=3500:
        d=4*a*b- b*n -a*n
        if  d > 0:
            c=a*b*n/(d)
            if int(c)==c:
                print(a, b, int(c)) 
                z=1
                break 
        b+=1
    a+=1

Submission status: Accepted

Solution code:
N = int(input())
ans = [0, 0, 0]

for h in range(1, 3501):
    for n in range(1, 3501):
        if (4*n*h-N*n-N*h) <= 0:
            continue
        
        if ((N*h*n) % (4*n*h-N*n-N*h)) == 0:            
            ans[0] = h
            ans[1] = n
            ans[2] = (N*h*n) // (4*n*h-N*n-N*h)
            break
    if sum(ans) != 0:
        break

for a in ans:
    print(a, end=" ")

Submission status: Accepted

Solution code:
# coding: utf-8
# Here your code !
N = int(input())

w = 0
for h in range(1 , int(3*N/4 )+ 1) : 
    if w != 0 : 
        h -= 1
        break
    x = 4 / N - 1 / h
    if x <= 0 : continue
    for n in range(1 , int(2/(4/N - 1/h)) + 1) : 
        if (4*h*n - N*n - N*h)  <= 0 : continue
        if (N*h*n) % (4*h*n - N*n - N*h)  == 0 : 
            w = int((N*h*n) / (4*h*n - N*n - N*h) )
            break
        
print(h ,n,w)

Submission status: Accepted

Solution code:
N=int(input())
for h in range(N//4+1,3501):
    for w in range((N*h)//(4*h-N)+1,3501):
        if N*w*h%(4*h*w-N*h-N*w)==0:
            d=N*w*h//(4*h*w-N*h-N*w)
            print('{} {} {}'.format(h,w,d))
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
n = int(input())

def solve(n):
	for x in range(1, 3501):
		nx = n * x
		for y in range(x, 3501):
			# 4/n = 1/x + 1/y + 1/z
			# 1/z = 4/n - 1/x - 1/y
			# z = 1/(4/n - 1/x - 1/y)
			# z = nxy/(4xy - ny - nx)
			nxy = nx * y
			den = 4*x*y - n*y -nx
			if (den > 0 and nxy % den == 0 and nxy//den > 0):
				print(x, y, nxy//den)
				return

solve(n)

Submission status: Accepted

Solution code:
import sys
N = int(input())
for h in range(1,3501):
    for n in range(h,3501):
        if (4*h*n - N*n - N*h) > 0:
            w = N*h*n//(4*h*n - N*n - N*h)
        else: continue
    
        if w != 0 and 4/N == (1/h + 1/n + 1/w):
            print(h, n, w)
            sys.exit()

Submission status: Accepted

Solution code:
N = int(input())

h_upper = int(0.75*N)
for h in range(h_upper, 0, -1):
    tmp = int(2/(4/N-1/h))
    for n in range(tmp,0,-1):
        if 4*h*n-N*(h+n)>0 and (N*h*n)%(4*h*n-N*(h+n)) == 0 :
            print(h,n,(N*h*n)//(4*h*n-N*(h+n)))
            break
    else:
        continue
    break

Submission status: Runtime Error

Solution code:
N = int(input())
A = [int(input()) for i in range(N)]

A.sort()
left = A[0]
right = A[N - 1]
ans = right - left
for i in range((N - 2) // 2):
    if i % 2 == 0:
        ans += right - A[1 + i]
        ans += A[N - 2 - i] - left
        right = A[1 + i]
        left = A[N - 2 - i]
    else:
        ans += left - A[1 + i]
        ans += A[N - 2 - i] - right
        left = A[1 + i]
        right = A[N - 2 - i]

if N % 2 == 1:
    ans += max(abs(right - A[N // 2]), abs(left - A[N // 2]))

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
for h in range(1, 3501):
  for n in range(1, 3501):
    a = N*h*n
    b = 4*h*n - N*n - N*h
    if a % b:
      continue
    print(h, n, a//b)

Submission status: Runtime Error

Solution code:
a = input()
for h in range(1, 3501):
  for n in range(1, 3501):
    for w in range(1, 3501):
      if 4/a == 1/h + 1/n + 1/w:
        print(h, n, w)
        break
    else:
        continue
    break
  else:
    continue
  break

Submission status: Runtime Error

Solution code:
from fractions import Fraction
N=int(input())
list=[]
for a in range(1,3*N//4+1):
    X=Fraction(4,N)-Fraction(1,a)
    for b in range(a,2//X+1):
        if  not 4*a*b-b*N-a*N==0:
            c=N*a*b//(4*a*b-b*N-a*N)
            if c<b :
                continue
            else:
                list.append(a)
                list.append(b)
                list.append(c)
            break
print(str(list[0])+' '+str(list[1])+' '+str(list[2]))

Submission status: Runtime Error

Solution code:
N=int(input())
for h in range(1,3501):
    for n in range(1,3501):
        if 4/N-1/h-1/n==0:
            continue
        w=(N*h*n)/(4*h*n-N*n-h*N)
        if w==int(w) and w>=1:
            print(h,n,int(w))
            exit()

Submission status: Runtime Error

Solution code:
N=int(input())
for h in range(1,3501):
  for n in range(1,3501):
    w=(N*h*n)/(4*h*n-N*(h+n))
    if w%1==0:print(h,n,int(w));exit()

Submission status: Runtime Error

Solution code:
N = int(input())
p = N//4
s=1
r=1
t=1
for i in range(2*p,3500):
    for j in range(2*p,3500):
        for l in range(p,3500):
            if (i*j + j*l + l*i)*N//(i*j*l) == 4:
                i =str(i)
                j=str(j)
                l=str(l)
                print(i+" "+j+" "+l)
                s=int(l)
                r=int(j)
                t =int(i)
                break
        if (t*r + r*s + s*t)*N//(t*r*s) == 4:
            break
    if (t*r + r*s + s*t)*N//(t*r*s) == 4:
        break

Submission status: Runtime Error

Solution code:
n=int(input())
x=time.time()
for i in range(1,3501):
  for j in range(2,3501):
    p=4*i*j-n*(i+j)
    if p>0:
      q=n*i*j
      if q%p==0:
        print(i,j,q//p)
        exit()

Submission status: Runtime Error

Solution code:
N = int(input())
ans = 0
while ans == 0: 
	for h in range(3500):
		h = h + 1
		for n in range(3500):
			n = n + 1
			up = 4*h*n - n*N - N*h
			down = N*h*n
			if up  0:
				if down % up == 0:
					w = down // up
					ans = 1
					break
		if ans == 1:
			break
print(h, n , w)

Submission status: Runtime Error

Solution code:
N = int(input())
ans = 0
while ans == 0: 
	for h in range(3500):
		h = h + 1
		for n in range(3500):
			n = n + 1
			up = 4*h*n - n*N - N*h
			down = N*h*n
			if up > 0:
				if down % up == 0:
					w = down // up
					ans = 1
					break
		if ans == 1:
			break
print(h, n , w

Submission status: Runtime Error

Solution code:
m = int(input())
for n in(m):
    if(n > 100):
        ans+=n
    elif(n < 100):
        ans*=n
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())

for x in range(1, 3500 + 1):
    for y in range(1, 3500 + 1):
        p = n * x * y
        q = 4 * x * y - n * (x + y)
        if p % q == 0:
            print(x, y, p // q)
            exit()

Submission status: Runtime Error

Solution code:
n = int(input())

for x in range(1, 3500 + 1):
    for y in range(1, 3500 + 1):
        p = n * x * y
        q = 4 * x * y - n * (x + y)
        if p % q == 0:
            print(p, q, p // q)
            break

Submission status: Runtime Error

Solution code:
N = int(input())

maxh = int(3 * N / 4)

for h in range(1, min(maxh, 3501)):
    maxn = int(2 / (4 / N - 1 / h))
    for n in range(h, min(maxn, 3501)):
        w_reciprocal = (4 / N) - (1 / h) - (1 / n)
        if w_reciprocal > 0:
            w = 1 / w_reciprocal
            if w < 3501 and int(w) == w:
                w = int(w)
                print(h, n, w, sep = ' ')
                exit()

Submission status: Runtime Error

Solution code:
N=int(input())
def ok(h,n,w,N):
    if 4*h*n*w==N*(n*w+n*h+h*w):
        return 1
    else:
        return 0

def kiyaku(a,b):
    if b%a==0:
        return 1
    else:
        return 0

def solve(N):

    for i in range(N//4+1,3*N//4+1):
        for j in range(3*N//4+1,3501):
            if kiyaku(4*i*j-N*(i+j),N*i*j) and 4*i*j-N*(i+j)>0:
                return (i,j,N*i*j//(4*i*j-N*(i+j)))

    return (-1,-1,-1)
h,n,w=solve(N)
print(h,n,w)

Submission status: Runtime Error

Solution code:
import numpy as np
import itertools

N = int(input())
k = 4 / N

def f(h, n):
    hn = h * n
    return -(hn / (n + h - hn * k))


for h, n in itertools.permutations(range(3500), r=2):
    w = f(h, n)
    if w % 1 == 0 and 0 < w:
        print(int(w), h, n)
        exit()

Submission status: Runtime Error

Solution code:
N = int(input())

for h in range(1,3501):
    n_min = N //(4*h) + (N%(4*h)) * 1
    for n in range(n_min,3501):
        if (N*(h+n)) % (4*h*n-N) == 0:
            w = N*(h+n) // (4*h*n-N)
            print(h,n,w)
#            print(N*(h+n+w) , (4*h*n*w))
            exit()

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;

int main(void){
  long long n, h, w;
  long long N, p, q;
  cin >> N;
  bool end = false;
  for(h = 1; h<=3500; h++){
    for(n = 1; n<=3500; n++){
      p = 4*h*n-N*n-N*h;
      q = N*h*n;
      if(p>0 && q%p == 0){
        w = q / p;
        cout << h << " " << n << " " << w;
        end = true;
        break;
      }
    }
    if(end) break;
  }
}