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

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

Solution (Python):
x = int(input())

for ch in range(1, 3501):
    for cn in range(1, 3501):
        a = ch*cn
        if 4*ch*cn % x:
            continue
        b = 4*ch*cn//x - cn - ch
        if b > 0 and a % b == 0:
            print(ch, cn, a//b)
            print()
            exit()

Solution (Python):
N = int(input())

for h in range((N + 3) // 4, 3501):
    for n in range((N + 3) // 4, 3501):
        a = N * h * n
        b = 4 * h * n - N * (h + n)
        if a > 0 and b > 0 and a % b == 0:
            print("{0} {1} {2}".format(h, n, a//b))
            exit()

Solution (Python):
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 b == 0:
      continue
    if a % b:
      continue
    if a//b < 0:
      continue
    print(h, n, a//b)
    exit()

Solution (Python):
import sys
N=int(input())
for n in range(1,2*N+1):
  for w in range(1,N+1):
    try:
      h = w*n*N // (4*w*n-(n+w)*N)
    except:
      continue
    if h>0 and h*(4*w*n-(n+w)*N) - w*n*N == 0:
      print(h,n,w)
      sys.exit()

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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

    for h in range(1, 3501):
        for n in range(1, 3501):
            if 4 * n * h - N * n - N * h == 0:
                continue
            q, r = divmod(N * n * h, 4 * n * h - N * n - N * h)
            if r == 0 and q > 0:
                print(h, n, q)
                return


if __name__ == '__main__':
    main()

Solution (Python):
import sys
from math import ceil,floor
N=int(input())
b=3501

for h in range(ceil(3*N/4),b):
  for w in range(1,floor(3*N/4)+1):
    if 4*h*w-N*h-N*w>0:
      if N*h*w % (4*h*w-N*h-N*w)==0:
        n=N*h*w//(4*h*w-N*h-N*w)
        print(h,n,w)
        sys.exit()

Solution (Python):
N = int(input())
 
for h in range(1, 3501):
  for n in range(1, 3501):
    a = (4 * h * n) - N * h - N * n
    if a <= 0:
      continue
    w = (N * h * n) / a
    if w.is_integer() and 0 < w:
      print(h, n, int(w))
      exit(0)

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

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

Solution (Python):


import sys
from typing import Any, Callable, Deque, Dict, List, Mapping, Optional, Sequence, Set, Tuple, TypeVar, Union































def main():
    Num = Union[int, float]
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input():  return sys.stdin.readline().rstrip()
    def ii():     return int(input())
    def isp():    return input().split()
    def mi():     return map(int, input().split())
    def mi_0():   return map(lambda x: int(x)-1, input().split())
    def lmi():    return list(map(int, input().split()))
    def lmi_0():  return list(map(lambda x: int(x)-1, input().split()))
    def li():     return list(input())
    def debug(x): print(x, file=sys.stderr)
    
    
    def calc(N):
        if N % 2 == 0:
            return N, N, N // 2
        else:
            
            for n in range(1, 3501):
                for w in range(1, 3501):
                    numerator = N * n * w
                    denominator = 4 * n * w - N * n - N * w
                    if denominator > 0 and numerator % denominator == 0:
                        return (numerator // denominator), n, w
        
    
    N = ii()
    h, n, w = calc(N)
    print(f'{h} {n} {w}')


if __name__ == "__main__":
    main()

Solution (Python):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    
    
    for h in range(1,3501):
        for n in range(1,3501):
            temp=(4*h*n-(n+h)*N)
            if temp>0:
                if ((N*h*n)%temp)==0:
                    print(h,n,(N*h*n)//temp)
                    exit()
    
                    
                    

main()

Solution (Python):
N = int(input())

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

Solution (Python):
N=int(input())
h,n,w=0,0,0

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

Solution (Python):
N=int(input())
flag=0
for i in range(1,3500):
    for j in range(1,3500):
        if (4*i*j-N*i-N*j)>0:
            if (N*i*j)%(4*i*j-N*i-N*j)==0:
                print(i,j,(N*i*j)//(4*i*j-N*i-N*j))
                flag=1
                break
    if flag==1:
        break

Solution (Python):
n = int(input())
for i in range(1, 3501):
    for j in range(i, 3501):
        a = i * j
        b = i + j
        if not 4 * a == n * b:
            k = (n * a) / (4 * a - n * b)
            if k % 1 == 0 and k > 0:
                print(i, j, int(k))
                exit()

Solution (Python):
n = int(input())
import sys
l = 3500
for a in range(1, l):
    for b in range(1, l):
        if (4*a*b - n*(a+b)) > 0 and n*a*b % (4*a*b - n*(a+b)) == 0:
            print(a, b, n*a*b // (4*a*b - n*(a+b)))
            sys.exit()

Solution (Python):

import math
N = int(input())
flag = False
for h in range(1, 3501, 1):
    for n in range(1, 3501, 1):
        bumbo = 4 * h * n - N * h - N * n
        bunshi = N * h * n
        if bumbo == 0:
            continue
        wc = math.ceil(bunshi / bumbo)
        wf = math.floor(bunshi / bumbo)
        if wc == wf and wc >= 1:
            ans_h = h
            ans_n = n
            ans_w = wc
            flag = True
            break
    if flag:
        break
print(ans_h, ans_n, ans_w)

Solution (Python):

n = int(input())








for a in range(1,3501):
    for b in range(1,3501):
        if 4*a*b-n*b-n*a == 0: continue
        w = n*a*b/(4*a*b-n*b-n*a)
        
        if w == int(w) and w > 0:
            print(a,b,int(w))
            exit()

Solution (Python):
N = int(input())
for n in range(1, 3501):
    for w in range(1, 3501):
        denominator = 4*n*w - w*N - n*N
        numerator = n*w*N
        if denominator != 0 and numerator%denominator == 0:
            h = numerator // denominator
            if 0 < h <= 3500:
                print(h, n, w)
                break
    else:
        continue
    break

Solution (Python):
import math
N = int(input())
for h in range(1,3501):
    for n in range(1,h):
        d = 4*h*n-N*n-N*h
        if d>0:
            w = N*h*n/d
            if w.is_integer():ans = [h,n,int(w)]
print(ans[0],ans[1],ans[2])

Solution (Python):
N = int(input())
for h in range(1,3501):
    for n in range(1,3501):
        if (4 * h * n - N * n - N * h) != 0 and (N * h * n) % (4 * h * n - N * n - N * h) == 0:
            if (N * h * n) // (4 * h * n - N * n - N * h) > 0:
                print("{} {} {}".format(h,n,(N * h * n) // (4 * h * n - N * n - N * h)))
                exit()

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

N=int(input())
for h in range(1,3501):
    for n in range(1,3501):
        if (4*h*n-N*n-N*h)!=0 and (N*h*n)%(4*h*n-N*n-N*h)==0 and 1<=(N*h*n)//(4*h*n-N*n-N*h)<=3500:
            w=(N*h*n)//(4*h*n-N*n-N*h)
            print(h,n,w)
            exit()

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

    for h in range(1, 3500 + 1):
        for n in range(1, 3500 + 1):
            numerator = N * h * n
            denominator = 4 * h * n - N * n - N * h
            if denominator == 0:
                continue
            if numerator % denominator != 0:
                continue
            w = numerator // denominator
            if w <= 0:
                continue
            print(h, n, w)
            return

    print(-1)


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())

for h in range(1, 3501):
	for n in range(1, 3501):
		if 4*h*n-N*n-N*h > 0 and N*h*n % (4*h*n-N*n-N*h) == 0:
			print (h, n, N*h*n // (4*h*n-N*n-N*h))
			exit()

Solution (Python):
N = int(input())
flag = 0
x = 0
y = 0
z = 0
for h in range(N//4+1,3501):
    for n in range((N*h)//(4*h-N)+1,3501):
        a = N*h*n
        b = 4*h*n-N*(h+n)
        if a%b==0:
            x = h
            y = n
            z = a//b
            flag=1
            break
    if flag==1:break
print(x,y,z)

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

Solution (Python):
n=int(input())
for a in range(n//4+1,3501):
 for b in range((n*a)//(4*a-n),3501):
  if 4*a*b-n*b-a*n==0:
   continue
  c=(n*a*b)/(4*a*b-n*b-a*n)
  if c==int(c) and c>=1:
    print(a,b,int(c))
    exit()

Solution (Python):
n = int(input())

for x in range(1, 3501):
    for y in range(1, 3501):
        tmp1 = n*x*y
        tmp2 = 4*x*y - n*x - n*y
        if tmp2 > 0 and int(tmp1/tmp2) == tmp1/tmp2: 
            print(x, y, int(tmp1/tmp2))
            exit()

Solution (Python):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    N = int(readline())
    for h in range(1, 3501):
        for n in range(1, 3501):
            if 4 * h * n - N * n - N * h != 0:
                w = (N * h * n) / (4 * h * n - N * n - N * h)
                if int(w) == w and w > 0:
                    print(h, n, int(w))
                    exit()


if __name__ == '__main__':
    solve()

Solution (Python):
N=int(input())
for h in range(1,3501):
    for n in range(1,3501):
        if 4*h*n-N*n-h*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()

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

Solution (Python):
from fractions import*
N=int(input())

for h in range(1,3501):
 for n in range(h,3501):
  x=4*h*n-N*n-N*h
  if x>0 and N*h*n%x==0:print(h,n,N*h*n//x),quit()

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

Solution (Python):


def main():
    N = int(input())
    for h in range(N // 4 + 1, 3501):
        for n in range(N * h // (4 * h - N) + 1, 3501):
            numerator = N * h * n
            denominator = 4 * h * n - N * n - N * h
            if denominator > 0 and numerator % denominator == 0:
                w = numerator // denominator
                print(h, n, w)
                return


if __name__ == "__main__":
    main()

Solution (Python):


def main():
    N = int(input())
    for h in range(1, 3501):
        for n in range(1, 3501):
            numerator = N * h * n
            denominator = 4 * h * n - N * n - N * h
            if denominator > 0 and numerator % denominator == 0:
                w = numerator // denominator
                print(h, n, w)
                return


if __name__ == "__main__":
    main()

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

Solution (Python):
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    return a * b // gcd(a, b)


def main():
    N = int(input())
    MAX = 3501
    for h in range(1, MAX):
        gcdNh = gcd(N, h)
        for n in range(1, MAX):
            gcdNhn = gcd(gcdNh, n)
            denom = N * h * n // gcdNhn**2
            num = 4 * denom // N - denom // h - denom // n
            if num > 0 and denom % num == 0:
                w = denom // num
                print(h, n, w)
                return


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
def ac():
    for h in range(1,3501):
        for w in range(1,3501):
            try:
                num=(n*h*w)/(4*h*w-n*w-n*h)
                
                if (num).is_integer() and num>0:
                    print("{} {} {}".format(h,w,int(num)))
                    return
            except:
                pass
if __name__=="__main__":
    ac()

Solution (Python):
def calc(h,n,N):
  if 4*h*n-N*(h+n)!=0:
    return (N*h*n)//(4*h*n-N*(h+n))
  else:
    return 0

N=int(input())
for h in range(1,3501):
  for n in range(1,3501):
    w=calc(h,n,N)
    if w>0:
      if 4/N==1/h+1/n+1/w:
        print(h,n,w)
        exit()

Solution (Python):
a=int(input())
for h in range(1,3501):
    for n in range(1,3501):
        if 1/h+1/n>=4/a:continue
        w=(a*h*n)/(4*h*n-a*n-a*h)
        if w==int(w):
            print(h,n,int(w))
            exit()

Solution (Python):
n = int(input())
for a in range(1,3501):
    for b in range(1,3501):
        x = 4*a*b-a*n-b*n
        y = a*b*n
        if x != 0:
            if y/x >= 1 and int(y/x) == y/x:
                print(a,b,int(y/x))
                exit()

Solution (Python):
n = int(input())
for a in range(1,3501):
    for b in range(1,3501):
        if -a*n-b*n+4*a*b != 0:
            if (a*b*n)/(4*a*b-a*n-b*n) > 1 and int((a*b*n)/(4*a*b-a*n-b*n)) == (a*b*n)/(4*a*b-a*n-b*n):
                print(a,b,int((a*b*n)/(4*a*b-a*n-b*n)))
                exit()

Solution (Python):
N = int(input())

flag = 0
for n in range(1,3500):
    if flag == 1:
        break
    for w in range(1,3500):
        if (4*n*w - N*w - N*n) == 0:
            continue
        h = N*n*w / (4*n*w - N*w - N*n)
        if h%1 == 0 and 1 <= h <= 3500:
            flag = 1
            break

print('{} {} {}'.format(int(h), n-1, w))

Solution (Python):
N = int(input())
judge = 0
for h in range(1,3501):
    for w in range(1,3501):
        if 4*w*h - N*h - N*w > 0 and N*h*w % (4*w*h - N*h - N*w) == 0:
            n = N*h*w // (4*w*h - N*h - N*w)
            judge = 1
            break
    if judge == 1:
        break

print(h,w,n)

Solution (Python):
N=int(input())
for h in range(1,3501):
    for n in range(h,3501):
        a=N*n*h
        b=4*n*h-N*(n+h)
        if b>0 and a%b==0 :
            print(n,h,a//b)
            quit()

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

Solution (Python):
N = int(input())
for n in range(1, 3501):
    for w in range(1, 3501):
        denominator = 4*n*w - w*N - n*N
        numerator = n*w*N
        if denominator != 0 and numerator%denominator == 0:
            h = numerator // denominator
            if 0 < h <= 3500:
                print(h, n, w)
                break
    else:
        continue
    break

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()

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

Solution (Python):



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

    for h in range(1, 3500 + 1):
        for n in range(1, 3500 + 1):
            a = large_n * h * n
            b = 4 * h * n - large_n * (n + h)

            if b != 0:
                w, q = divmod(a, b)

                if q == 0 and w > 0:
                    print(h, n, w)
                    exit()


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
for i in range(1,3501):
  for j in range(1,3501):
   if (4*i*j-n*i-n*j)!=0:
    if (n*i*j)//(4*i*j-n*i-n*j) >0 and  (n*i*j)%(4*i*j-n*i-n*j)== 0:
      print(i,j,(n*i*j)//(4*i*j-n*i-n*j))
      exit()

Solution (Python):
n=int(input())
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()

Solution (Python):
n=int(input())
for i in range(1,3501):
  for j in range(1,3501):
    if (4*i*j-n*i-n*j)!=0:
      if (n*i*j)%(4*i*j-n*i-n*j)==0 and (n*i*j)//(4*i*j-n*i-n*j)>0:
        k=(n*i*j)//(4*i*j-n*i-n*j)
        break
  else:
    continue
  break
print(i,j,k)

Solution (Python):
n = int(input())

for x in range(1, 3500 + 1):
    for y in range(1, 3500 + 1):
        q = 4 * x * y - n * (x + y)     
        if q <= 0: continue

        p = n * x * y
        if p % q == 0:
            z = p // q
            print(x, y, z)
            exit()

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

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

Solution (Python):
n = int(input())
for a in range(1,3501):
    for b in range(a,3501):
        if 4/n <= 1/a + 1/b:
            continue
        if 4/n > 1/a + 2/b:
            break
        c = 1/(4/n - 1/a - 1/b)
        x = int(c)
        if 4/n == 1/a + 1/b + 1/x:
            print(a,b,x)
            exit()
        x = int(c)+1
        if 4/n == 1/a + 1/b + 1/x:
            print(a,b,x)
            exit()

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

Solution (Python):
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:
                print(i,j,(N*i*j)//(4*i*j-N*i-N*j))
                exit()

Solution (Python):
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 4*i*j-N*(i+j)>0 and kiyaku(4*i*j-N*(i+j),N*i*j):
                return (i,j,N*i*j//(4*i*j-N*(i+j)))
h,n,w=solve(N)
print(h,n,w)

Solution (Python):
import sys

N = int(input())
for h in range(1, 3501):
    for n in range(1, h+1):
        if (4*h*n - N*h - N*n) <= 0:
            continue
        w_int = N*h*n // (4*n*h - N*h - N*n)
        w_float = N*h*n / (4*n*h - N*h - N*n)
        if w_int == w_float:
            print(h, n, w_int)
            sys.exit()

Solution (Python):
N=int(input())
s=False
for i in range(1,3501):
    for j in range(1,3501):
        if (4*i*j-N*i-N*j)>0:
            w=(N*i*j)/(4*i*j-N*i-N*j)
            if w%1==0:
                p=i
                q=j
                s=True
                break
    if s==True:
        break

print("{} {} {}".format(p,q,int(w)))

Solution (Python):
N=int(input())
flag=False
for i in range(1,3501):
    if flag==True:
        break
    for j in range(1,3501):
        if 4*i*j-N*i-N*j>0:
            w=N*i*j/(4*i*j-N*i-N*j)
            if w%1==0:
                print(*[i,j,int(w)])
                flag=True
                break

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N = int(input())

for h in range(1,3501):
	for n in range(1,3501):
		si = h*n*N
		bo = 4*h*n-(h+n)*N
		if bo > 0 and si%bo == 0:
			print(h,n,si//bo)
			sys.exit()

Solution (Python):
def c_4_over_n(N):
    for h in range(1, 3501):
        for n in range(1, h + 1):
            
            numerator = N * h * n
            denominator = 4 * h * n - N * n - N * h
            
            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))

Solution (Python):
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)
        
        if q > 0:
            
            
            p = N * n * h
            if p % q == 0:
                w = p // q
                flg = True
                break
    if flg:
        break
print(h, n, w)

Solution (Python):
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)

Solution (Python):
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

Solution (Python):

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()

Solution (Python):
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()

Solution (Python):
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()

Solution (Python):
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()

Solution (Python):
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)

Solution (Python):
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)))

Solution (Python):
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())

Solution (Python):
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)

Solution (Python):
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()

Solution (Python):
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()

Solution (Python):
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()

Solution (Python):
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()

Solution (Python):

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()

Solution (Python):
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()

Solution (Python):
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()

Solution (Python):
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()

Solution (Python):
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()

Solution (Python):
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()

Solution (Python):
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()

Solution (Python):
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()

Solution (Python):
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()

Solution (Python):
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()

Solution (Python):
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()