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

import math

ans = [0,0,0]

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

print(" ".join(map(str,ans)))

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

def isOK(n,w):
    if 4*n*w-N*w-N*n==0:
        return False
    if N*n*w%(4*n*w-N*w-N*n)==0:
        h=N*n*w//(4*n*w-N*w-N*n)
        if 0<h:
            return h
    return False

for i in range(1,3501):
    for j in range(1,3501):
        if isOK(i,j):
            print(i,j,isOK(i,j))
            exit()

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

print(h,n,w)

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

def main():
    N = int(input())
    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()




if __name__ == "__main__":
    main()

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

Solution (Python):

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

    for h in range(1, 3500 + 1):
        for n in range(1, 3500 + 1):
            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)
                if w > 0:
                    print(h, n, w)
                    return

if __name__ == "__main__":
    main()

Solution (Python):
from numba import njit

N = int(input())


@njit
def f():
    for h in range(1, 3501):
        for n in range(1, 3501):
            x = 4 * h * n - N * n - N * h
            if x != 0 and N * h * n % x == 0:
                w = N * h * n // x
                if w >= 1:
                    return h, n, w


print(*f())

Solution (Python):
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 and N * h * n % x == 0:
            w = N * h * n // x
            if w >= 1:
                print(h, n, w)
                exit()

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:
            w = (N * h * n) // (4 * h * n - N * n - N * h)
            if w > 0:
                print(h, n, w)
                exit(0)

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

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

for i in range(1, 3501):
    for j in range(1, 3501):
        if N*(i+j) < 4*i*j:
            w = 1 / (4/N - 1/i - 1/j)
            if abs(int(w)-w) < 10**-7:
                print(i, j, int(w))
                ok = True
                break
    if ok:
        break

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

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


def solve(h, n):
    if (4*h*n-N*n-N*h) == 0:
        return
    w = N*h*n // (4*h*n-N*n-N*h)
    if w < 1:
        return
    if w*(4*h*n-N*n-N*h) == N*h*n:
        print(h, n, w)
        exit()


if N < 2000:
    for h in range(1, 3501):
        for n in range(1, 3501):
            solve(h, n)
else:
    for h in reversed(range(1, 3501)):
        for n in reversed(range(1, 3501)):
            solve(h, n)

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:
            continue
        w = N*h*n // (4*h*n-N*n-N*h)
        if w < 1:
            continue
        if w*(4*h*n-N*n-N*h) == N*h*n:
            print(h, n, w)
            exit()

Solution (Python):
def tenka17_c():
    N = int(input())
    ans = None
    for x in range(1, 3501):
        for y in range(1, 3501):
            a = N * x * y
            b = 4*x*y - N*y - N*x
            if b < 1: continue
            if a % b == 0:
                ans = (x, y, a//b)
                break
        if ans: break
    print(*ans, sep=' ')

tenka17_c()

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import numpy as np


n = int(input())
U = 3500
for x in range(1, U+1):
    y = np.arange(1, U+1, dtype=np.int64)
    den = 4 * x * y - n * x - n * y
    num = n * x * y
    y = y[(num % den == 0) & (den > 0)]
    if len(y) > 0:
        y = y[0]
        z = (n * x * y) // (4 * x * y - n * x - n * y)
        break
print(x, y, z)

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')
AtoZ = "abcdefghijklmnopqrstuvwxyz"






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  divisors.sort()
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


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


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




N = I()

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

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')
AtoZ = "abcdefghijklmnopqrstuvwxyz"






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  divisors.sort()
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


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


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




N = I()

p = factorization(N)[0][0]
r = N//p

k = 1
while True:
  flag = 0
  d = make_divisors(p*k)
  for j in d[1:]:
    if 4*k-1-j in d:
      a = (p*k)//j
      b = (p*k)//(4*k-1-j)
      flag = 1
  if flag:
    break
  k += 1
  
print(a*r,b*r,k*p*r)

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:
            if n*h*N%(4*h*n-n*N-h*N) == 0:
                print(h, n, n*h*N//(4*h*n-n*N-h*N))
                exit()

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:
            w = (N * h * n) / (4 * h * n - N * n - N * h)
            if w > 0 and w % 1 == 0:
                print(h, n, int(w))
                exit()

Solution (Python):
import sys

n = int(input())


for i in range(1, 3500):
    for j in range(1, 3500):
        
        rest = 4 * i * j - n * i - n * j
        if rest > 0:
            ans = n * i * j / rest
            if ans.is_integer():
                print(i, j, int(ans))
                sys.exit()

Solution (Python):
def solve(N):
    for h in range(1, 3501):
        for n in range(1, 3501):
            v1 = 4*h*n-N*(h+n)
            v2 = N*h*n
            if v1>0 and v2>0 and v2%v1==0:
                return h, n, v2//v1

N = int(input())
h, n, w = solve(N)
print(h, n, w)

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import permutations
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7






N = getN()

def judge(n, h, N1):
    fraction = n * h * N1
    denominator = (4 * h * n) - (N1 * n) - (N1 * h)
    if denominator > 0 and fraction % denominator == 0 and 0 < fraction // denominator <= 3500:
        return fraction // denominator
    return -1

for i in range(1, 3501):
    for j in range(1, 3501):
        res = judge(i, j, N)
        if res > 0:
            print(i, j, res)
            break
    else:
        continue
    break

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    
    for h in range(1, 3501):
        for n in range(1, 3501):
            denom = 4 * h * n - N * n - N * h
            if denom == 0:
                continue
            w = (N * h * n) / denom
            if w.is_integer() and 0 < w:
                print(h, n, int(w))
                return


if __name__ == '__main__':
    solve()

Solution (Python):
def do():
    n = int(input())
    for b in range(1,3501):
        for c in range(1,3501):
            if (4*b*c - n*b - n*c) == 0:
                continue
            a = (n*b*c) / (4*b*c - n*b - n*c)
            if a < 1:
                continue
                

            if a.is_integer():
                print(int(a),b,c)
                return 0
    return 0
do()

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

for h in range(1,3501):
    for n in range(1,3501):
        x,y=N*h*n,4*h*n-n*N-h*N
        if y==0:
            continue
        w=x/y
        if w>0 and math.floor(w)==math.ceil(w):
            print(h,n,math.floor(w))
            exit()

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

for h in range(1,3501):
    for n in range(1,3501):
        x=4*n*h-n*N-h*N
        if x==0:
            continue
        w=h*n*N/x
        if w<=0:
          continue
        if N/int(w)+N/h+N/n==4:
            print(n,h,int(w))
            exit()

Solution (Python):
n=int(input())
a=n*3//4+3
for i in range(max(n//4,1),a):
    for j in range(a-3,3501):
        k=4*i*j-n*(i+j)
        if k==0:
            continue
        x,y=divmod(n*i*j,k)
        if y==0 and x>0:
            print(i,j,x)
            exit()

Solution (Python):
n=int(input())
a=n*3//4+3
for i in range(max(n//4,1),a):
    for j in range(a-3,3501):
        k=4*i*j-n*(i+j)
        if k==0:
            continue
        x,y=divmod(n*i*j,4*i*j-n*(i+j))
        if y==0 and x>0:
            print(i,j,x)
            exit()

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

Solution (Python):
import sys

N=int(input())

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

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

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

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

N = int(readline())

for i in range(1,3501):
    for j in range(1,3501):
        if 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):
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

INF = 10**18
eps = 10**-7

N = int(readline())

for i in range(1,3501):
    for j in range(1,3501):
        if 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 h in range(1,3500):
    for w in range(1,3500):
        if (4*h*w-N*h-N*w)==0:continue
        if N*h*w%(4*h*w-N*h-N*w):continue
        x=N*h*w//(4*h*w-N*h-N*w)
        if x>0:
            print(h,w,x);exit()

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

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

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

jdg = True

for h in range(math.ceil(N/4), 3501):
    for n in range(h, 3501):
        num = 4*h*n - N*h - N*n
        if num > 0:
            if (N * n * h) % num == 0:
                jdg = False
                break
    if not jdg: break

w = N*h*n//(num)
print(*[h, n, w])

Solution (Python):
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))



N = I()

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

print(h,n,w)

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)>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())
for h in range(1, 3501):
    for n in range(h, 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())
for h in range(1, 3501):
    for n in range(h, 3501):
        ok = 0
        ng = 3501
        while abs(ok-ng)>1:
            w = (ok+ng)//2
            if 4*h*n*w<=N*(n*w+w*h+h*n):
                ok = w
            else:
                ng = w
        if 4*h*n*ok==N*(n*ok+ok*h+h*n):
            print(h, n, ok)
            exit()

Solution (Python):
import sys

import math


from collections import deque

from fractions  import gcd
input=sys.stdin.readline
w=0
ah=an=0
N=int(input())
for h in range(1,3501):
    for n in range(h,3501):
        if (4*h*n-N*n-N*h)!=0 and N*n*h%(4*h*n-N*n-N*h)==0:
            w=N*n*h//(4*h*n-N*n-N*h)
            ah=h
            an=n
            break
print(ah,an,w)

Solution (Python):
import sys


import math
import collections

import bisect
import itertools
import fractions

import copy
import heapq
import decimal

import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))





def main():
    N = ni()
    lim = 3500

    for h in range(1, lim + 1):
        for n in range(1, lim + 1):
            up = N * h * n
            down = 4 * h * n - N * n - N * h
            if down != 0:
                if up % down == 0:
                    if 0 < up // down:
                        print(h, n, up // down)
                        exit(0)


if __name__ == '__main__':
    main()

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

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

Solution (Python):

"""
nが与えられるので、
4/n = 1/a + 1/b + 1/c　となるa,b,cを出力せよ
なお、a,b,c<=3500となる中で1つは解があることが保証される。

多分半分全列挙のような解法になると思う

"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n = int(readline())
flag = 0
for a in range(1,3501):
    for b in range(1,3501):
        try:
            c = int(a*b*n/(4*a*b-n*b-n*a))
            if c<0:
                continue
            if 4*a*b*c//(b*c+c*a+a*b)==n:
                print(a,b,c)
                flag = 1
        except:
            pass
        if flag:
            exit()

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

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

if __name__ == "__main__":
    main()

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

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

if __name__ == "__main__":
    main()

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

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

if __name__ == "__main__":
    main()

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

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

if __name__ == "__main__":
    main()

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

Solution (Python):
def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

SIZE = 3501

def main():
    N = Z()
    for i in range(1, SIZE):
        for j in range(1, SIZE):
            x = N * i * j
            y = 4*i*j - N * (i+j)
            if y > 0 and x%y == 0:
                print(i, j, x//y)
                break
        else: continue
        break

    return

if __name__ == '__main__':
    main()

Solution (Python):
import sys

def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))

def main():
    N = II()
    MAX=3500
    for h in range(1,MAX+1):
        for n in range(1,MAX+1):
            d = 4*h*n-N*h-N*n
            if d > 0 and (N*h*n)%d==0:
                print('{} {} {}'.format(h, n, (N*h*n)//d))
                return None

if __name__ == '__main__':
    main()

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N = int(readline())
    for n in range(1,3501):
        for h in range(1,3501):
            x = 4*n*h-N*n-N*h
            if x<=0:
                continue
            else:
                if (N*h*n)%x==0:
                    print(n, h, (N*h*n)//x)
                    exit()


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
import math
U = math.ceil(3*N/4)
D = math.ceil(N/4)
if N % 2 == 0:
  ans = (N,N,N//2)
else:
  if D%2 == 1:
    D += 1
  h = -1
  for n in range(D,3500):
    if h > 0:
      break
    for w in range(n,3500):
      
      if w*n*N/(4*n*w-w*N-n*N) == int(w*n*N/(4*n*w-w*N-n*N)):
        h = w*n*N//(4*n*w-w*N-n*N)
        ans = (w*n*N//(4*n*w-w*N-n*N),n,w)
        break
        
print(*ans)

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

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

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

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

Solution (Python):
import sys


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

    for i in range(1, 3501):
        for j in range(1, 3501):
            if(4*i*j-N*(i+j) > 0):
                if((N*i*j)%(4*i*j-N*(i+j)) == 0):
                    print(i, j, int((N*i*j/(4*i*j-N*(i+j)))))
                    sys.exit()
                    
main()

Solution (Python):
def main():
    N = int( input())
    for x in range(1,3501):
        if 4*x - N < 0:
            continue
        for y in range(1, 3501):
            if 4*x*y <= N*(x+y):
                continue
            if N*x*y%(4*x*y-N*(x+y)) == 0:
                print(x, y, N*x*y//(4*x*y-N*(x+y)))
                return
if __name__ == '__main__':
    main()

Solution (Python):
def main():
    N = int( input())
    for x in range(1,3501):
        for y in range(1, 3501):
            if 4*x*y <= N*(x+y):
                continue
            if N*x*y%(4*x*y-N*(x+y)) == 0:
                print(x, y, N*x*y//(4*x*y-N*(x+y)))
                return
if __name__ == '__main__':
    main()

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    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*(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()

if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    for a in range(1,3501):
        for b in range(a,3501):
            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()

if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    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*(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()

if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    for a in range(1,3501):
        for b in range(a,3501):
            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()

if __name__=='__main__':
    main()

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

for i in range(1,3500+1):
    for j in range(1,3500+1):
        h = i
        n = j
        
        low = 1
        high = 3500
        
        if N*n+N*h-4*h*n == 0:
            continue
        if N*h*n % (N*n+N*h-4*h*n) == 0:
            w = -N*h*n // (N*n+N*h-4*h*n)
            if w > 0:
                print(h,n,w)
                exit()

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

for h in range(1,3501):
    for n in range(h,3501):
        x=(4*n*h-n*N-h*N)
        if x<=0 or n*h*N%x:continue
        print(h,n,n*h*N//x )
        exit()

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