PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000080. Thử thách BCNN lớn nhất của ba số (LCM Challenge)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Thử thách BCNN lớn nhất của ba số (LCM Challenge)

LCM Challenge

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Given a positive integer nn, choose exactly three positive integers a,b,ca,b,c (not necessarily distinct), each at most nn. Find the maximum possible value of lcm⁡(a,b,c)\operatorname{lcm}(a,b,c) over all choices. Print only that maximum value.

Input

One integer nn.

Output

Print one integer, the maximum possible LCM.

Subtasks

  • Subtask 1 (20 points): 1≤n≤1001\le n\le100.

  • Subtask 2 (30 points): 1≤n≤1041\le n\le10^4.

  • Subtask 3 (50 points): 1≤n≤1061\le n\le10^6.

Examples

Input

9

Output

504

Explanation

Choose 9,8,79,8,7. They are pairwise coprime, so their LCM is 9⋅8⋅7=5049\cdot8\cdot7=504. No triple of positive integers at most 99 yields a larger LCM.