#BS0000058. Thừa số nhỏ (Small Factors)

Thừa số nhỏ (Small Factors)

Small Factors

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Consider the set

$$C_{2,3}=\left\{2^i3^j\mid i,j\in\mathbb{Z}_{\ge0}\right\}.$$

Given a positive integer mm, find the smallest number nn such that n∈C2,3n\in C_{2,3} and n≥mn\ge m.

Equivalently, find the smallest integer not less than mm whose prime factorization contains no prime other than 22 and 33.

Input

The only line contains a positive integer mm.

Output

Print the smallest n∈C2,3n\in C_{2,3} satisfying n≥mn\ge m.

Subtasks

  • Subtask 1 — 20%: 1≤m≤1041\le m\le10^4.
  • Subtask 2 — 30%: 1≤m≤1091\le m\le10^9.
  • Subtask 3 — 50%: 1≤m≤2311\le m\le2^{31}.

Example

Input

100

Output

108

Explanation

108=22⋅33108=2^2\cdot3^3, and no value in C2,3C_{2,3} lies between 100100 and 107107.