Under construction

Still being built. Things may change

Muffinspelet

Time limit2sMemory limit1024 MB

Summary
Two players alternately split a pile of N muffins and eat one of the two parts; compute each player's total with optimal play.
Level

Medium5 of 10

Topics
Game theory, Greedy, Math, Implementation
Solved
No attempts yet

Problem

Alf and Beata were two young people who lived a long, long time ago, in an age before anyone could spend their afternoons on programming contests. Their lives were therefore much duller than the lives of young people today. How could anyone survive without computers, you might ask. The answer is simple: you bake!

Our two young people loved baking muffins, and often had large piles of them when they were done baking. To keep their kitchens from filling up with muffins, Beata challenged her friend to a game every evening: Muffinspelet.

Muffinspelet is played by two players (in our case, Alf and Beata) and one large pile of NN muffins. The players now take turns making moves. A move consists of player AA splitting the muffin pile into two piles (where one of the piles may be empty). The opponent then chooses one of the piles and eats all the muffins in it. On the next move the players switch roles, so player BB splits the pile and player AA eats one of the piles. They alternate in this way until all the muffins are gone.

Alf starts by making a move (that is, splitting the large pile), and Beata starts by eating one of the piles. Can you compute how many muffins Alf and Beata will eat over the course of the game if both play as well as possible (that is, each wants to eat as many muffins as possible)?

Hint: when splitting a pile of muffins, you always want to split it into two piles whose sizes are as equal as possible (see the example explanations).

Input

The first and only line of the input contains the integer NN, the number of muffins in the pile at the start.

Output

Print two integers: the number of muffins Alf will eat and the number of muffins Beata will eat if both play as well as possible.

Constraints

  • N≤10 000N \le 10\,000

Examples4

  1. Example 1

    Input
    1
    
    Expected output
    0 1
    
  2. Example 2

    Input
    4
    
    Expected output
    1 3
    
  3. Example 3

    Input
    8
    
    Expected output
    3 5
    
  4. Example 4

    Input
    13
    
    Expected output
    4 9