Overflowing with Sweetness

Time limit1sMemory limit256 MB

Summary
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)

A picture of a cake and a macaron

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.

Examples2

  1. Example 1

    Input
    15 16 17
    19 32 90
    
    Expected output
    2 2 75
    
  2. Example 2

    Input
    15 8 15
    22 8 22
    
    Expected output
    7 1 7