PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000280. Mùa giải bóng đá (The Football Season)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Mùa giải bóng đá (The Football Season)

The Football Season

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

A football team played exactly nn matches and gained pp points. Each win scores ww, each draw dd, each loss 00. Find nonnegative integers x,y,zx,y,z describing wins, draws and losses, such that x+y+z=nx+y+z=n and wx+dy=pwx+dy=p. Any valid triple is accepted.

Input

One line contains four integers n,p,w,dn,p,w,d: matches, total points, points per win and per draw.

Output

If impossible, print -1. Otherwise print three space-separated integers x,y,zx,y,z.

Subtasks

  • Subtask 1 (20 points): 1≤n≤1001\le n\le 100; 0≤p≤10170\le p\le 10^{17}; 1≤d<w≤1051\le d<w\le 10^5.
  • Subtask 2 (30 points): 1≤n≤10000001\le n\le 1000000; 0≤p≤10170\le p\le 10^{17}; 1≤d<w≤1051\le d<w\le 10^5.
  • Subtask 3 (50 points): 1≤n≤10000000000001\le n\le 1000000000000; 0≤p≤10170\le p\le 10^{17}; 1≤d<w≤1051\le d<w\le 10^5.

Examples

Example 1

Input

30 60 3 1

Output

17 9 4

Explanation

There are 30 games, worth 3 per win and 1 per draw. The displayed triple sums to 30 matches and yields exactly 60 points.

Example 2

Input

10 51 5 4

Output

-1

Explanation

There are 10 games, worth 5 per win and 4 per draw. The target exceeds the maximum total of n*w points.

Example 3

Input

20 0 15 5

Output

0 0 20

Explanation

There are 20 games, worth 15 per win and 5 per draw. The displayed triple sums to 20 matches and yields exactly 0 points.