JULKA - Julka


Julka surprised her teacher at preschool by solving the following riddle:

Klaudia and Natalia have 10 apples together, but Klaudia has two apples more than Natalia. How many apples does each of he girls have?

Julka said without thinking: Klaudia has 6 apples and Natalia 4 apples. The teacher tried to check if Julka's answer wasn't accidental and repeated the riddle every time increasing the numbers. Every time Julka answered correctly. The surprised teacher wanted to continue questioning Julka, but with big numbers she could't solve the riddle fast enough herself. Help the teacher and write a program which will give her the right answers.

Task

Write a program which

  • reads from standard input the number of apples the girls have together and how many more apples Klaudia has,
  • counts the number of apples belonging to Klaudia and the number of apples belonging to Natalia,
  • writes the outcome to standard output

Input

Ten test cases (given one under another, you have to process all!). Every test case consists of two lines. The first line says how many apples both girls have together. The second line says how many more apples Klaudia has. Both numbers are positive integers. It is known that both girls have no more than 10100 (1 and 100 zeros) apples together. As you can see apples can be very small.

Output

For every test case your program should output two lines. The first line should contain the number of apples belonging to Klaudia. The second line should contain the number of apples belonging to Natalia.

Example

Input:
10
2
[and 9 test cases more]

Output:
6
4
[and 9 test cases more]


hide comments
Dark_night: 2011-05-27 14:27:57

please solve if input is 33 and 4?????????????

Pulkit Bansal: 2011-05-27 09:50:32

@Ankit Sablok
1
1
makes sense.

Last edit: 2011-05-27 09:51:30
Neeraj Bhat: 2011-05-26 17:24:35

what should be the output for
4
1
I am getting
3
1
but the difference is wrong........
anybody who get AC explain it.

V.Dineshkumar: 2011-05-14 08:22:16

@Ishan:wat datatype are u using?

Dima: 2011-03-23 16:47:06

If I get impossible case for solving, like:
8
3
then what will be correct result?
We may write in the 1st line the number of Klaudia's apples, in the 2nd
- number of Natalia's apples.
So 8, 3 - wrong input?

Last edit: 2011-03-23 16:53:00
story: 2011-03-13 05:49:26

once we are able to handle with such large integers there is nothing much to do, still i am getting wrong answer. Please suggest something, atleast few test cases
thank U.. :)

TouristGuide: 2010-12-21 20:48:39

what should be the output for
3232
1233
I'm getting 2232 and 999..but that doesnt add up to 3232!

Ankit Sablok: 2010-11-17 14:15:00

is it always that the numbers are divisble by 2 always otherwise this question doesnt make sense

Yinsi Rio Kusuma: 2010-10-19 13:37:54

@Sævar Berg:

try using integer division. it worked for me.

Sævar Berg: 2010-09-14 18:47:00

Eh.. Isn't this problem basically solving the equation 2x + y = z for x where y = how many more apples klaudia has and z = how many apples they have together?

If not, and there is some subtle thing to solving this challenge, this text is seriously badly written.


Added by:Adam Dzedzej
Date:2004-06-08
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS PERL6 VB.NET
Resource:Internet Contest Pogromcy Algorytmow (Algorithm Tamers)
Round II, 2003