Under construction

Still being built. Things may change

Last Casino

Time limit2sMemory limit512 MB

Summary
Given n bins, pick a ball count from 1 to 10^6 and a red, black, or white coloring that makes Alice's and Britney's win probabilities as close as possible.
Level

Hard8 of 10

Topics
Math, Probability, Combinatorics
Solved
No attempts yet

Problem

The movie The Last Casino is about a professor who exploits probabilities to beat the casino and win often at blackjack. This has terrified Lucy, the owner of the new casino in town, The Little Epsilon (TLE), so she has banned blackjack in her casino.

To bring people into TLE, she has invented a new game called bins-and-balls. Two players, Alice and Britney, play it. There are nn bins, and each bin is red, black, or white. There are BB balls. Each ball is placed independently and at random into one of the nn bins, and every bin is equally likely. If all of the balls end up in red bins, Alice wins. If there is at least one ball in a white bin and at least one ball in a black bin, Britney wins. In every other case, the casino wins.

The government has placed these restrictions on the game:

  1. The casino can choose the number of bins.
  2. The casino must choose how many balls to use (an integer from 1 to 10610^6 inclusive) and how to color the bins, so that the absolute difference between the probability of Alice winning and the probability of Britney winning is minimized.
  3. If more than one choice satisfies restriction 2, the casino must choose the one that minimizes the casino's probability of winning.

Restriction 2 keeps the game fair for the players. Restriction 3 keeps the casino from gaining too large an advantage. Lucy has already decided on the number of bins. You must decide the color of each bin and the number of balls so that the government's restrictions are met.

Input

The input consists of a single line with one integer nn (1≤n≤1061 \le n \le 10^6), the number of bins the casino will use.

Output

Print the number of balls to use. On the next line, print the number of bins to color black and the number of bins to color white. The remaining bins are colored red. If there are multiple solutions, any one of them is accepted.

Examples1

  1. Example 1

    Input
    5
    
    Expected output
    2
    1 2