Dick and Jane

Interview

Time limit1sMemory limit128 MB

Summary
Given that Spot was s when Puff was born, Puff was p when Yertle was born, and Spot was y when Yertle was born, find the three current ages.
Level

Medium6 of 10

Topics
Math, Brute force, Implementation
Solved
No attempts yet

Problem

Dick is 12 years old. Saying that someone is nn years old means that at least nn but strictly fewer than n+1n + 1 full years have passed since they were born — every age is rounded down to a whole number of years.

Dick and Jane have three pets: Spot the dog, Puff the cat, and Yertle the turtle. Three facts are known:

  • Spot was ss years old when Puff was born.
  • Puff was pp years old when Yertle was born.
  • Spot was yy years old when Yertle was born.

Each of these ages is a whole number of years, rounded down exactly as Dick's age is. Moreover, the sum of Spot's, Puff's, and Yertle's ages equals the sum of Dick's age (which is 1212) and Jane's age (jj).

Determine the current ages of Spot, Puff, and Yertle.

Input

Each line contains four non-negative integers separated by single spaces: ss, pp, yy, and jj. Input continues until end of file, and every line describes an independent scenario.

Output

For each input line, print one line with three integers separated by single spaces: the current ages of Spot, Puff, and Yertle, in that order. Each age is a whole number of years, using the same rounding-down rule described above.

Examples3

  1. Example 1

    Input
    5 5 10 9
    5 5 10 10
    5 5 11 10
    
    Expected output
    12 7 2
    13 7 2
    13 7 2
    
  2. Example 2

    Input
    3 2 5 0
    
    Expected output
    7 4 1
    
  3. Example 3

    Input
    0 0 0 0
    
    Expected output
    4 4 4