Farm

Interview

Time limit0.1sMemory limit512 MB

Summary
Given feed rates a and b, animal count n, and total feed w, find the sheep and goat counts, or print -1 if the answer is missing or not unique.
Level

Easy3 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

Sangbae, the owner of a farm, raises sheep and goats together. He keeps at least one sheep and at least one goat. The sheep and the goats eat the same feed: one sheep eats exactly a grams of feed per day, and one goat eats exactly b grams per day.

Every morning Sangbae checks how many sheep and how many goats he has. Because the animals wander around, counting them exactly is not easy. Instead, he plans to find the two counts from the total number of animals and the total amount of feed the animals ate during the previous day.

Given that the total number of animals Sangbae counted is n and that the total amount of feed eaten during the previous day is w grams, write a program that finds how many sheep and how many goats there are.

Input

Input is read from standard input. The first line contains four integers a, b, n, w on one line. 1 ≤ a ≤ 1,000, 1 ≤ b ≤ 1,000, 2 ≤ n ≤ 1,000, 2 ≤ w ≤ 1,000,000.

Output

Output is written to standard output. On the first line, print the number of sheep and the number of goats. If there is more than one possible answer, or if there is no possible answer, print -1.

Examples3

  1. Example 1

    Input
    3 4 9 32
    
    Expected output
    4 5
    
  2. Example 2

    Input
    3 4 8 32
    
    Expected output
    -1
    
  3. Example 3

    Input
    100 100 2 200
    
    Expected output
    1 1