Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

math

*3100

No tag edit access

The problem statement has recently been changed. View the changes.

×
E. Circles of Waiting

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputA chip was placed on a field with coordinate system onto point (0, 0).

Every second the chip moves randomly. If the chip is currently at a point (*x*, *y*), after a second it moves to the point (*x* - 1, *y*) with probability *p*_{1}, to the point (*x*, *y* - 1) with probability *p*_{2}, to the point (*x* + 1, *y*) with probability *p*_{3} and to the point (*x*, *y* + 1) with probability *p*_{4}. It's guaranteed that *p*_{1} + *p*_{2} + *p*_{3} + *p*_{4} = 1. The moves are independent.

Find out the expected time after which chip will move away from origin at a distance greater than *R* (i.e. will be satisfied).

Input

First line contains five integers *R*, *a*_{1}, *a*_{2}, *a*_{3} and *a*_{4} (0 ≤ *R* ≤ 50, 1 ≤ *a*_{1}, *a*_{2}, *a*_{3}, *a*_{4} ≤ 1000).

Probabilities *p*_{i} can be calculated using formula .

Output

It can be shown that answer for this problem is always a rational number of form , where .

Print *P*·*Q*^{ - 1} modulo 10^{9} + 7.

Examples

Input

0 1 1 1 1

Output

1

Input

1 1 1 1 1

Output

666666674

Input

1 1 2 1 2

Output

538461545

Note

In the first example initially the chip is located at a distance 0 from origin. In one second chip will move to distance 1 is some direction, so distance to origin will become 1.

Answers to the second and the third tests: and .

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jun/20/2024 06:03:06 (l2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|