# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

# Who Gets the Money!?

By masrur · Limits 1s, 512 MB

Who doesn’t get happy after getting money in the pockets of clothes before washing them? During this pandemic, Jenia washes clothes at home as they don’t keep a maid as outsiders are not allowed at home to avoid risk. Even though Jenia gets the money while washing, but she and her siblings end up in a fight while claiming the money. Jenia has twin siblings, Umair and Zuaina. Since school is closed so her siblings don’t study at all. Thus Jenia thought of a game to avoid the chaos for money as well as make her siblings practice mathematics. It’s a game where the twin will compete jenia as a team. So she gave the twins `\$N\$` pieces of paper and asked them to write positive odd numbers sequentially but following a rule. The rule is :

• They will write one positive odd number in the first paper which is `\$1\$`.
• In the second paper, they will write the next two positive odd numbers which are `\$3\$`,`\$5\$`.
• In the third paper, they will write the next three positive odd numbers which are `\$7\$`, `\$9\$`, `\$11\$`.
• In the fourth paper, they will write `\$13\$`, `\$15\$`, `\$17\$`, `\$19\$`. They must continue writing these papers until the Nth piece of paper following this rule.

Zuaina will keep the papers where the total number of numbers written on a paper is even. Umair will keep the rest. Both of them will separately find the sum of all the numbers in all the papers they currently have. Let Zuaina’s sum is `\$S_1\$` and Umair’s sum is `\$S_2\$`.

The next task of the twins is to find the total sum `\$S\$` where `\$S = S_1 + S_2\$`. The prize money of this game is, `\$R_{actual} = S \% P\$` where `\$P\$` is the money that was found in the pockets. It is always guaranteed that P is a prime number. The twins will try to find the correct value of prize money, but they might make mistakes in the calculation as they are still learning about modulo operation. Let’s say the prize money that twins calculated is `\$R_{Twin's Answer}\$` .

If `\$R_{Twin's Answer}\$`=`\$R_{actual}\$` then the twins gets the prize money and Jenia will get to keep the rest of the money. If `\$R_{Twin's Answer}\$` `\$\neq\$` `\$R_{actual}\$` then Jenia will keep the prize money and the twins will keep the rest of the money. It doesn’t matter if the prize money, `\$R_{actual}\$`, is greater or less than the rest of the money, `\$P-R_{actual}\$`. That’s the fun part of this game.

Jenia is busy with her online classes and is unable to check the result. Given `\$N\$`, `\$P\$` and `\$R_{Twin's Answer}\$`, can you be the judge and let them know how much Jenia and the team of twins will get.

## Input

The input contains a single line with three integers `\$N\$`, `\$P\$`, `\$R_{Twin's Answer}\$`where `\$1≤N≤10^{12}\$` ,`\$P\$` is a prime in the range `\$(1,5000)\$` and `\$0≤R_{Twin's Answer}<P\$`.

## Output

Print two integers that indicate the amount Jenia and the team of twins will get sequentially separated by a space between them.

## Samples

InputOutput
```4 53 47
```
```6 47
```
InputOutput
```4 53 23
```
```47 6
```

Here, N = 4 so there will be 4 papers.
Zuaina will have 3, 5, 13, 15, 17,19 and Umair will have 1, 7, 9, 5
`\$S_1\$`= 72, `\$S_2\$` =28, `\$S\$`=100, `\$R_{actual}\$` = 100%53 = 47
So in the first sample input `\$R_{Twin's Answer}\$`=`\$R_{actual}\$`, Jenia will get 6 and the twins will get 47.
In the second sample input `\$R_{Twin's Answer}\$` `\$\neq\$` `\$R_{actual}\$`, Jenia will get 47 and the twins will get 6.

### Statistics

60% Solution Ratio

blizzardEarliest, 2M ago

obaydullahmhsFastest, 0.0s

obaydullahmhsLightest, 131 kB

aNkanpy.pritomShortest, 106B