new game he found online during math class. Because he is quite good at math, tunes out the current math lecture and makes quick work of the final boss.

is playing aDisappointed by the underwhelming task,

draws up another game:The player character begins with units of magic and consumes one unit of magic for every symbol drawn. Of course, if the player cannot consume a unit of magic (i.e. there is none remaining), the symbol will not be drawn.

There are enemy ghosts which will spawn one at a time, **in the order they appear** in the input.

The player can defeat the ghost by drawing symbols. If the ghost is defeated, the player will be awarded with units of magic. Otherwise, the ghost will simply cross over to the next life by vanishing instantly from the map.

As the end of the period draws near,

wants to determine the maximum possible number of ghosts which can be killed, and given this maximum, would also like to maximize the amount of magic remaining.Can you write a program to help

?#### Input Specification

The first line of the input will contain two space-separated integers and , denoting the number of enemy ghosts to appear and the amount of magic the player has to start off in the game respectively.

The next lines of input will contain two space-separated integers and , denoting the number of symbols required to be drawn to defeat the ghost, and the amount of magic the player will be awarded upon defeating this ghost, respectively.

#### Constraints

##### Subtask 1 [30%]

##### Subtask 2 [20%]

##### Subtask 3 [50%]

It is guaranteed the net magic awarded after defeating a ghost will never cause the player's magic to exceed and in subtasks and both and respectively.

All numbers in the input will fit into a signed 32-bit integer.

#### Output Specification

Output two space-separated integers on a single line.

The first integer will denote the maximum possible number of ghosts the player can defeat if they play optimally.

The second integer will denote the maximum amount of magic remaining in the player's possession after defeating the maximum possible number of ghosts.

#### Sample Input 1

```
5 7
2 2
3 0
3 1
5 3
3 1
```

#### Sample Output 1

`4 1`

#### Explanation 1

The best possible score for ghosts, ignoring ghost # who rewards magic. The amount of magic remaining after each victory resolves *in order* is , , , and .

#### Sample Input 2

```
2 3
5 2
6 1
```

#### Sample Output 2

`0 3`

#### Explanation 2

, and the maximum amount of magic he has remaining for defeating those ghosts is the units he possessed from the beginning.

does not have enough magic to defeat either ghost spawned. Therefore, the maximum number of ghosts he can defeat is
## Comments

Is there any editorial available?

Why do I get a WA return? Is it because of python?

Yes, there is a custom checker for this problem that fails you if it detects python code.

Actually tho : https://dmoj.ca/problem/dmopc16c3p3/rank/?language=PY3 https://dmoj.ca/problem/dmopc16c3p3/rank/?language=PY2

Send python some love

Noice