The ACM-ICPC World Finals are over! Which team came out on top? Why, only our favourite team - everyone's favourite team - the most deserving, lovable, courteous, powerful, flawless, successful team that has ever existed. Who else?

It's time to celebrate, and what better way is there to celebrate than
by eating cake? The contest organizers have bought
cakes (conveniently numbered ) - however, ever
generous, The Team will only eat cake 1, leaving the rest for the other,
inferior teams. They *will* need their cake to be as tasty as possible,
though. To help with this, globs of icing are
available, which will be distributed among the cakes. Icing is always
used in whole globs.

The cakes are arranged in a somewhat strange way - piled on top of one another. Cake 1 is directly on top of a table, while every other cake (for ) is directly on top of cake . is considered to have a value of 0. Note that there may be multiple cakes on top of a single cake, and that the entire structure obeys the laws of physics (no cake is on top of itself, and no cakes are floating).

Now, the tastiness of any cake is determined by the formula . and are simply properties of cake , which depend on its size, shape, weight, temperature, fluffiness, and so on. is the number of globs of icing that are chosen to be applied to cake . If there are no cakes on top of cake , - otherwise, is the minimal tastiness of any cake directly on top of cake . No cake will ever be capable of achieving a tastiness value larger than , no matter how the icing is distributed.

The members of The Team have already, of course, determined how the available icing could be optimally applied to the mountain of cakes to maximize the tastiness of their cake (cake 1). However, the contest organizers are the ones who will actually be distributing the icing, and they had better hope they get it right! Can you help them determine how tasty cake 1 should be? You don't want to know what The Team will do if their celebration isn't perfect…

#### Input Specification

First line: 2 integers, and

Next lines: 3 integers, , , and , for

#### Output Specification

1 integer, the maximal tastiness of cake 1, after all of the icing has been used.

#### Sample Input

```
3 2
0 5 1
1 3 4
1 2 6
```

#### Sample Output

`12`

#### Explanation of Sample

The optimal icing distribution is 1 glob each on cakes 2 and 3. This gives cake 2 a tastiness of , and cake 3 a tastiness of . Since both of these cakes are on top of cake 1, it then has a tastiness of . No other icing distribution yields a higher tastiness for cake 1.

## Comments