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 x in range(1,3501):
    for y in range(1,3501):
        if (4*x*y-n*y-n*x)>0 and (n*x*y)%(4*x*y-n*y-n*x)==0:
            z=(n*x*y)//(4*x*y-n*y-n*x)
            print(x,y,z)
            exit()

Solution (Python):
N = int(input())
for ai in range(N//4,3500):
    for bi in range(N//4,3500):
        try:
            ci = N*ai*bi/(4*ai*bi-N*ai-N*bi)
        except:
            continue
        if ci == int(ci) and ci > 0:
            print(ai,bi,int(ci))
            exit()

Solution (Python):
N = int(input())
for ai in range(N//4,3500):
    for bi in range(N//4,3500):
        try:
            ci = N*ai*bi/(4*ai*bi-N*ai-N*bi)
        except:
            continue
        if ci == int(ci) and ci > 0:
            print(ai,bi,int(ci))
            exit()

Solution (Python):
N = int(input())
for ai in range(1,3500):
    for bi in range(1,3500):
        try:
            ci = N*ai*bi/(4*ai*bi-N*ai-N*bi)
        except:
            continue
        if ci == int(ci) and ci > 0:
            print(ai,bi,int(ci))
            exit()

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()

    if N % 2 == 0:
        print(N, N, N // 2)
    else:
        ans = (0, 0, 0)
        for h in range(1, 3501):
            for n in range(h, 3501):
                
                num = N * n * h
                denom = 4 * h * n - N * (h + n)
                if denom > 0 and num % denom == 0:
                    w = num // denom
                    ans = (h, n, w)
                    break

        print(*ans)

if __name__ == '__main__':
    resolve()

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()

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

    print(*ans)

if __name__ == '__main__':
    resolve()

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

def f(n):
    res = []
    i = 1
    while i <= n**0.5:
        if n%i == 0:
            res.append(n)
            if N//i > i:
                res.append(N//i)
        i += 1
    return res

num = 4
if N%4 == 0:
    num = 1
    N //= 4
elif N%2 == 0:
    num = 2
    N //= 2

P = f(N)
P.sort(reverse=True)
ans = []
for p in P:
    i = 1
    while p*i <= 3500:
        Q = f(N//p)
        for q in Q:
            j = 1
            while q*j <= 3500:
                if num*p*i*q*j-(p*i+q*j)*N > 0 and ((p*i)*(q*j)*N)%(num*p*i*q*j-(p*i+q*j)*N) == 0:
                    ans = [p*i, q*j, ((p*i)*(q*j)*N)//(num*p*i*q*j-(p*i+q*j)*N)]
                    i = 4000
                    j = 4000
                j += 1
            if len(ans) > 0:
                break
        i += 1
    if len(ans) > 0:
        break

print(*ans)

Solution (Python):
import sys
import math
import copy
import heapq
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
sys.setrecursionlimit(1000000)


input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD

def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD

def fact_and_inv(SIZE):
    inv = [0] * SIZE  
    fac = [0] * SIZE  
    finv = [0] * SIZE  
    inv[1] = 1
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    for i in range(2, SIZE):
        inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD
        fac[i] = fac[i - 1] * i % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

    return fac, finv

def renritsu(A, Y):
    
    
    
    A = np.matrix(A)
    Y = np.matrix(Y)
    Y = np.reshape(Y, (-1, 1))
    X = np.linalg.solve(A, Y)

    
    return X.flatten().tolist()[0]

class TwoDimGrid:
    
    def __init__(self, h, w, wall="
        self.h = h
        self.w = w
        self.size = (h+2) * (w+2)
        self.wall = wall
        self.get_grid()
        

    def get_grid(self):
        grid = [self.wall * (self.w + 2)]
        for i in range(self.h):
            grid.append(self.wall + getS() + self.wall)

        grid.append(self.wall * (self.w + 2))
        self.grid = grid
    def init_cost(self):
        self.cost = [INF] * self.size

    def pos(self, x, y):
        
        return y * (self.w + 2) + x
    def getgrid(self, x, y):
        return self.grid[y][x]
    def get(self, x, y):
        return self.cost[self.pos(x, y)]
    def set(self, x, y, v):
        self.cost[self.pos(x, y)] = v
        return
    def show(self):
        for i in range(self.h+2):
            print(self.cost[(self.w + 2) * i:(self.w + 2) * (i+1)])
    def showsome(self, tgt):
        for t in tgt:
            print(t)
        return
    def showsomejoin(self, tgt):
        for t in tgt:
            print("".join(t))
        return

    def search(self):
        grid = self.grid
        move = [(0, 1), (0, -1), (1, 0), (-1, 0)]
        move_eight = [(0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
        
        
        
        
        

def solve():
    n = getN()
    for a in range(1, 3501):
        for b in range(a, 3501):
            if (4 * a * b / n) - b - a == 0:
                continue
            c = round((a * b) / ((4 * a * b / n) - b - a))
            if c <= 0:
                continue
            if n * (a * b + b * c + c * a) == 4 * a * b * c:
                print(a,b,c)
                return
def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    
    solve()

Solution (Python):

        
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()

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




                
if __name__ == '__main__':
    main()

Solution (Python):
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    for a in range(1, 3501):
        for b in range(1, 3501):
            L = 4*a*b - (a+b)*N
            R = a*b*N
            if L <= 0:
                continue
            if R % L == 0:
                c = R // L
                print(a, b, c)
                exit()


if __name__ == '__main__':
    main()

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


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

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

for h in range(1, 3501):
    for n in range(1, 3501):
        try:
            w = (N * h * n) / (4 * (h * n) - (N * n) - (N * h))
        except:
            continue
        if w.is_integer() and w > 0:
            if 4 * (h * n * w) == N * ((n * w) + (h * w) + (h * n)):
                ans = [h, n, int(w)]
                exit(print(' '.join(map(str, ans))))

Solution (Python):
from fractions import Fraction
import math
N = int(input())
ans = Fraction(4,N)
point = [1,math.floor(N/4)]
for h in range(1,3501):
    h_pro = Fraction(1,h)
    for n in range(1,3501):
        check = ans - h_pro
        n_pro = Fraction(1,n)
        check -= n_pro
        if type(check) == "int":
            if check ==1:
                print(h, end=" ")
                print(n, end=" ")
                print(1)
                exit()
        elif check.numerator == 1:
            print(h, end=" ")
            print(n, end=" ")
            print(check.denominator)
            exit()

Solution (Python):
from fractions import Fraction
import math
N = int(input())
ans = Fraction(4,N)
point = [1,math.floor(N/4)]
for h in range(max(point),3501):
    h_pro = Fraction(1,h)
    check = ans - h_pro
    target = [math.floor(4*h-N/N*h),h]
    for n in range(h,3501):
        check = ans - h_pro
        n_pro = Fraction(1,n)
        check -= n_pro
        if type(check) == "int":
            if check ==1:
                print(h, end=" ")
                print(n, end=" ")
                print(1)
                exit()
        elif check.numerator == 1:
            print(h, end=" ")
            print(n, end=" ")
            print(check.denominator)
            exit()

Solution (Python):


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
    h, n, w <= 3500
    4/N = 1/h+1/n+1/w
    1/h = 4/N-1/n-1/w = 4nw-Nw-Nn / Nnw
    """
    N = read_int()
    for w in range(1, 3501):
        for n in range(1, 3501):
            if (4*n*w-N*w-N*n) != 0 and (N*n*w)%(4*n*w-N*w-N*n) == 0:
                h = (N*n*w)//(4*n*w-N*w-N*n)
                if h > 0:
                    return h, n, w


if __name__ == '__main__':
    print(*solve())

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

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

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

for h in range(1,3501):
  for n in range(h,3501):
    w1 = N*h*n
    w2 = 4*h*n-N*n-N*h
    if w2 == 0:
      continue
    if w1%w2 == 0:
      w = w1//w2
      if w > 0:
        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) - 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):
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):
N = int(input())
for h in range(1,3501):
    for n in range(1,3501):
        t1 = 4 * h * n
        t2 = N * (h+n)
        if t1 != t2:
            temp = (N*h*n) / (t1-t2)
            if temp.is_integer():
                if temp > 0:
                    print(h,n,int(temp))
                    break
    else:
        continue
    break

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:
      continue
    w = i*j*n/(4*i*j - n*i - n*j)
    if w == int(w) and w > 0:
      print(i,j,int(w))
      exit()

Solution (Python):
def main():
    N = int(input())
    
    
    for h in range(1, 3501):
        for n in range(1, 3501):
            d = 4 * h * n - N * (n + h)
            if d <= 0 or (N * h * n) % d != 0 or (N * h * n) // d > 3500:
                continue
            w = (N * h * n) // d
            print(h, n, w)
            return


if __name__ == '__main__':
    main()

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

Solution (Python):
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()

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

Solution (Python):
def main():
    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    N = int(input())
    for h in range(1, 3501):
        if N >= 4 * h:
            continue
        for n in range(h, 3501):
            if N * (h + n) >= 4 * h * n:
                continue
            t1 = N * h * n
            t2 = 4 * h * n - N * n - N * h
            if t1 % t2 == 0:
                print(h, n, t1 // t2)
                return True

if __name__ == '__main__':
    main()

Solution (Python):
import sys

N = int(sys.stdin.readline())





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 and a % b == 0:
            w = a // b
            
            print(h, n, w)
            sys.exit()
else:
    print("something wrong")

Solution (Python):
import sys

N = int(sys.stdin.readline())





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 and a % b == 0:
            w = a // b
            
            print(h, n, w)
            sys.exit()
else:
    print("something wrong")

Solution (Python):
def main():
  N = int(input())
  flag = False
  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, int(N*i*j/(4*i*j-N*i-N*j)))
        flag = True
        break
    if flag:
      break
        
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-h*N <= 0:
      continue
    if N*h*n % (4*h*n-n*N-h*N) == 0:
      w = N*h*n // (4*h*n-n*N-h*N)
      print("{} {} {}".format(h,n,w))
      exit()

Solution (Python):
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

N=int(input())
for h in range(1,3501):
    for n in range(h,3501):
        if (4*h*n-N*n-N*h)!=0:
            if (N*h*n)%(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>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, 3500 + 1):
    for n in range(1, 3500 + 1):
        if 4 * h * n - N * n - N * h == 0:
            continue
        w = (N * h * n) // (4 * h * n - N * n - N * h)
        if (N * h * n) % (4 * h * n - N * n - N * h) == 0 and w > 0:
            print(h, n, w)
            exit()

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

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

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

Solution (Python):
from math import floor
from sys import exit

def isinteger(n):
    if isinstance(n,int):
        return True
    if isinstance(n,float):
        return n.is_integer()
    return False

n = int(input())
for i in range(floor(1700*n/(7000-n)-1),floor(3*n/4)+2):
    if 14000*i != (3500+i)*n and 4*i != n:
        mini = 3500*n*i/(14000*i-(3500+i)*n)
        maxi = 2*n*i/(4*i-n)
        for j in range(floor(mini)-1,floor(maxi)+2):
            if i!=0 and j!=0 and 4/n != 1/i+1/j:
                w = 1/(4/n-1/i-1/j)
                if abs(w-round(w))<=10**(-8) and 3500>=w>=1 and j >= 1 and i >= 1:
                    exit(print(i,j,round(w)))
            else:
                continue
    else:
        continue

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

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

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

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

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

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

Solution (Python):
N=int(input())
'''
4hnw=N(hn+nw+wh)
=(n+w)Nh + nwN
0=(Nw+Nn-4nw)h + nwN
h = -(nwN)/(Nw+Nn-4nw)
'''
for w in range(1,3501):
	for n in range(1,3501):
		if (N*w+N*n!= 4*n*w) :
			h = -(n*w*N)/(N*w+N*n-4*n*w)
			if  h==int(h) and h > 0:
			  print(int(h),n,w)
			  exit(0)

Solution (Python):
import math

import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit


ipt = stdin.readline
setrecursionlimit(10**7)

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

    return None

if __name__ == '__main__':
    main()

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    N = in_n()

    for a in range(1, 3500):
        for b in range(a, 3500):
            t1 = N * a * b
            t2 = 4 * a * b - N * (a + b)
            if t2 == 0:
                continue
            else:
                c = t1 / t2
                if c.is_integer() and 1 <= c:
                    print(a, b, int(c))
                    exit()


if __name__ == '__main__':
    main()

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    N = in_n()

    for a in range(1, 3500):
        for b in range(a, 3500):
            t1 = N * a * b
            t2 = 4 * a * b - N * (a + b)
            if t2 == 0:
                continue
            else:
                c = t1 / t2
                if c.is_integer() and 1 <= c:
                    print(a, b, int(c))
                    exit()


if __name__ == '__main__':
    main()

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    N = in_n()

    for a in range(1, 3500):
        for b in range(a, 3500):
            t1 = N * a * b
            t2 = 4 * a * b - N * (a + b)
            if t2 == 0:
                continue
            else:
                c = t1 / t2
                if c.is_integer() and 1 <= c and c <= 3500:
                    print(a, b, int(c))
                    exit()


if __name__ == '__main__':
    main()

Solution (Python):





import math
import fractions
import sys
import bisect
import heapq  
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    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 power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod



def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


inf = 10 ** 18
mod = 10 ** 9 + 7

N = ir()
h0 = (3*N)//4
for h in range(h0,3501):
    n0 = (2*N*h)//(4*h-N)
    for n in range(n0,3501):
        if (N*h*n)%(4*h*n-N*(n+h)) == 0:
            print(h,n,(N*h*n)//(4*h*n-N*(n+h)))
            sys.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*h - N*n
    if b != 0 and a % b == 0 and 0 < a//b <= 3500:
      print(h,n,a//b)
      exit()

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

Solution (Python):
import math

N = int(input())
f = False
for h in range(1,3501):
    if f:
        break
    for n in range(1,3501):
        if 4*n*h-N*n-N*h == 0:
            continue
        check = N*n*h/(4*n*h-N*n-N*h)
        if check < 0:
          continue
        if check.is_integer():
            print(h, n, math.floor(check))
            f = True
            break

Solution (Python):
n = int(input())
if n<=3000:
  for a in range(1,3501):
    for b in range(1,3501):
      s = n*a*b
      
      t = 4*a*b-n*b-n*a
      
      if s<=t*3500:
        if t!=0 and s%t==0 and t>0:
          c = s//t
          print(a,b,c)
          exit()
else:
  for a in range(3501,1,-1):
    for b in range(3501,1,-1):
      s = n*a*b
      
      t = 4*a*b-n*b-n*a
      
      if s<=t*3500:
        if t!=0 and s%t==0 and t>0:
          c = s//t
          print(a,b,c)
          exit()

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

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

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

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


N = int(input())
done = False
for h in range(1, 3501):
    for n in range(1, 3501):
        v = (4*h*n) - N*(h+n)
        if v>0 and (N*h*n) % v == 0:
            ans = (h,n, (N*h*n) // v)
            print(" ".join(map(str, ans)))
            done = True
            break
    if done:
        break

Solution (Python):
import sys

from numba import njit

input = sys.stdin.readline


@njit("Tuple((i8,i8,i8))(i8)")
def solve(N):
    for h in range(1, 3501):
        for n in range(1, 3501):
            a = N * h * n
            b = 4 * h * n - (h + n) * N
            if b > 0 and a % b == 0:
                w = a // b
                return h, n, w
    return -1, -1, -1


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


if __name__ == "__main__":
    main()

Solution (Python):
import sys
from numba import njit

input = sys.stdin.readline


@njit
def solve(N):
    for h in range(1, 3501):
        for n in range(1, 3501):
            a = N * h * n
            b = 4 * h * n - (h + n) * N
            if b > 0 and a % b == 0:
                w = a // b
                return h, n, w


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


if __name__ == "__main__":
    main()

Solution (Python):
import sys

input = sys.stdin.readline


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

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


if __name__ == "__main__":
    main()

Solution (Python):
from itertools import product
def main():
    n = int(input())
    for x, y in product(range(1, 3501), repeat = 2):
        if 4 * x * y - n * (x + y) != 0:
            z = n * x * y / (4 * x * y - n * (x + y))
        else:
            continue
        if z.is_integer() and z > 0:
            print(x, y, int(z))
            break

if __name__ == '__main__':
    main()

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

            w = numerator // denominator
            if numerator % denominator == 0 \
            and 0 < w <= 3500:
                print(h,n,w)
                return
        
if __name__ == '__main__':
    solve()

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

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 0 < w and w.is_integer():
			print(h, n, int(w))
			exit()

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N = INT()

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

Solution (Python):
from numba import njit


@njit("UniTuple(i8, 3)(i8)")
def solve(N):
    for b in range(1, 3500 + 1):
        for c in range(1, 3500 + 1):
            num = N * b * c
            den = 4 * b * c - N * b - N * c
            if den > 0 and num % den == 0:
                a = num // den
                return a, b, c
    return 0, 0, 0


N = int(input())
print(*solve(N))

Solution (Python):
from numba import njit


@njit
def solve(N):
    for b in range(1, 3500 + 1):
        for c in range(1, 3500 + 1):
            num = N * b * c
            den = 4 * b * c - N * b - N * c
            if den > 0 and num % den == 0:
                return num // den, b, c


N = int(input())
print(*solve(N))

Solution (Python):



def main():
    N = int(input())
    for x in range(1,3501):
        for y in range(x,3501):
            bunshi = x*y*N
            bunbo  = 4*x*y-(x+y)*N
            if bunbo>0 and bunshi%bunbo==0:
                print(x,y,bunshi//bunbo)
                exit()

if __name__ == '__main__':
    main()