Under construction

Still being built. Things may change

The Battle of Giants

Interview

Time limit1sMemory limit512 MB

Summary
Given a final score a:b, decide whether it can result from matches worth 3 points for a win and 1 for a draw, and if so print win, draw, win counts using the fewest matches.
Level

Medium5 of 10

Topics
Math, Greedy, Implementation
Solved
No attempts yet

Problem

A famous programming contest organizer decided to hold a champions' competition called "The Battle of Giants". Two teams compete in the battle. Several matches are organized for the competition.

Each match can end with a win for one of the teams, or with a draw. When a team wins the match it scores 3 points, and the opposite team scores no point. In the case of a draw, teams score 1 point each. After all the matches end, the final score aa:bb is calculated: aa and bb are the number of points scored by the first and second team, respectively.

For example, if the first match is won by the first team, the second match ended with a draw, and the third match is also won by the first team, the final score is 7:1.

You are given the final score. Find out whether the given score is possible, and what the minimum number of matches could be. Print the number of matches won by the first team, the number of matches ended with a draw, and the number of matches won by the second team.

Input

The first line contains a single integer aa, the number of points scored by the first team.

The second line contains a single integer bb, the number of points scored by the second team.

The given aa and bb are nonnegative and don't exceed 10910^9.

Output

If the given final score isn't possible, print −1-1.

Otherwise, print three integers: the number of matches won by the first team, the number of matches ended with a draw, and the number of matches won by the second team, respectively. Find any solution with the minimum number of matches played.

Examples2

  1. Example 1

    Input
    7
    1
    
    Expected output
    2 1 0
    
  2. Example 2

    Input
    2
    1
    
    Expected output
    -1