Overflowing with Sweetness
Time limit1sMemory limit256 MB
Given triples a and c, find triple b with components in 1 to 100 such that performing the defined cake operation a cake b yields c.
- Level
Easy1 of 10
- Topics
- Math, Implementation, Brute force, Array
- Solved
- No attempts yet
Problem
Macaron, ripening deliciously in the refrigerator, got bored and came up with a new number system. Macaron named it the cake number and defined it as follows.
- A cake number is an ordered triple of three natural numbers x, y, z. (A natural number means an integer greater than or equal to 1.)
- A cake number a can be written as (a.x, a.y, a.z).
Macaron also defined a new equality sign "=" for comparing cake numbers.
- For cake numbers a and b, a = b means the following.
- a.x = b.x, a.y = b.y, and a.z = b.z all hold at the same time.
That is not all. Unlike ordinary numbers, cake numbers allow a very peculiar operation. The operation is named 🍰 and is defined as follows!
a 🍰 b = (a.z + b.x, a.y × b.y, a.x + b.z)

Uckje, the president of SCCC, decided to make a problem using cake numbers. Solve the problem to make Macaron and Uckje happy! The problem Uckje made is as follows.
Given cake numbers a and c, compute a cake number b that satisfies the following.
a 🍰 b = c
a and c are given so that b always exists uniquely.
Input
The first line gives the natural numbers a.x, a.y, a.z that make up cake number a, in that order. (1 ≤ a.x, a.y, a.z ≤ 100)
The second line gives the natural numbers c.x, c.y, c.z that make up cake number c, in that order. (1 ≤ c.x, c.y, c.z ≤ 100)
Output
Print b.x, b.y, b.z that satisfy the conditions of the problem, in that order, separated by a single space.
b satisfies 1 ≤ b.x, b.y, b.z ≤ 100 and always exists uniquely.