import java.math.BigInteger;
import java.util.*;

public class Euler176 {
    static long powU64(long base, int exp) {
        long r = 1;
        while (exp-- > 0)
            r *= base;
        return r;
    }

    static void collectFactorizations(int remaining, int minFactor, List<Integer> current, List<List<Integer>> out) {
        if (remaining == 1) {
            out.add(new ArrayList<>(current));
            return;
        }
        for (int f = minFactor; f <= remaining; f += 2) {
            if (remaining % f != 0)
                continue;
            current.add(f);
            collectFactorizations(remaining / f, f, current, out);
            current.remove(current.size() - 1);
        }
    }

    static BigInteger buildNumber(int twoExp, List<Integer> exponents) {
        long[] oddPrimes = { 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73 };
        List<Integer> sorted = new ArrayList<>(exponents);
        sorted.sort(Collections.reverseOrder());
        BigInteger val = BigInteger.ONE;
        if (twoExp > 0)
            val = val.shiftLeft(twoExp);
        for (int i = 0; i < sorted.size(); i++)
            val = val.multiply(BigInteger.valueOf(oddPrimes[i]).pow(sorted.get(i)));
        return val;
    }

    public static void main(String[] args) {
        int targetCount = 47547;
        int productTarget = 2 * targetCount + 1;
        BigInteger best = null;
        // Odd catheti
        List<List<Integer>> facts = new ArrayList<>();
        collectFactorizations(productTarget, 3, new ArrayList<>(), facts);
        for (List<Integer> of : facts) {
            List<Integer> exp = new ArrayList<>();
            for (int f : of)
                exp.add((f - 1) / 2);
            BigInteger c = buildNumber(0, exp);
            if (best == null || c.compareTo(best) < 0)
                best = c;
        }
        // Even catheti
        for (int factor = 1; factor <= productTarget; factor += 2) {
            if (productTarget % factor != 0)
                continue;
            int remaining = productTarget / factor;
            int twoExp = (factor + 1) / 2;
            List<List<Integer>> f2 = new ArrayList<>();
            collectFactorizations(remaining, 3, new ArrayList<>(), f2);
            if (remaining == 1)
                f2.add(new ArrayList<>());
            for (List<Integer> of : f2) {
                List<Integer> exp = new ArrayList<>();
                for (int f : of)
                    exp.add((f - 1) / 2);
                BigInteger c = buildNumber(twoExp, exp);
                if (best == null || c.compareTo(best) < 0)
                    best = c;
            }
        }
        System.out.println(best);
    }
}
