#D55. Light Source

    ID: 47 Type: Default 8000ms 134MiB

Light Source

Light Source

Problem

N circular light sources are arranged on a two-dimensional plane. When a light source receives light, the light is emitted in a fan shape from the center point of the light source as shown in the figure below.

The center point of the light source is represented by (x, y) and the radius is represented by r. The fan shape that becomes light spreads symmetrically in the directions of -θ / 2, + θ / 2 around the angle β, and its radius is α.

When the circle of light source is completely covered by fan-shaped light, the light source is considered to have received that light. The intensity of the light emitted from the light source is the sum of the intensities of the received light. However, there is an upper limit to the intensity of the emitted light, and if the upper limit is exceeded, the intensity of the light will be the same as the upper limit. The light is not blocked by a certain light or light source.

A light source existing at a certain point is used as a target light source. No light is emitted by the target light source, and there is no limit to the intensity of the light received. From coordinates (0,0), you can emit a fan-shaped light of a certain intensity only once in any direction. Create a program to find the maximum value of the total intensity of light received by the target light source. However, it may be assumed that all light sources do not provide input data such that the emitted light returns to the original light source. Also, in this problem, if the distance from the boundary of the area is within 0.000001, it is considered to be on the area.

Constraints

The input satisfies the following conditions.

  • All inputs consist of integers
  • 1 ≤ n ≤ 100
  • -1000 ≤ xi, yi ≤ 1000
  • 1 ≤ ri ≤ 1000
  • 1 ≤ θi ≤ 180
  • 1 ≤ αi ≤ 1000
  • 0 ≤ βi <360
  • 0 ≤ power, maxpoweri ≤ 1000

Input

n θ0 α0 power x1 y1 r1 θ1 α1 β1 maxpower1 .. .. xn yn rn θn αn βn maxpowern xn + 1 yn + 1 rn + 1

The number n of light sources excluding the target light source is given in the first line. The information on the coordinates (0,0) that first emit light on the second line, the information on the unintended light source on the third to n + 2 lines, and the information on the target light source on the n + 3 lines are separated by blanks. Given. For each information, xi and yi are the coordinates of the center point of the light source, ri is the radius of the light source, θi is the angle at which the light spreads, αi is the radius of the light, and βi is the direction in which the light is heading. The power in the second line represents the intensity of the first emitted light, and the maxpoweri in the third to n + second lines represents the upper limit of the emitted light. The direction βi of light rotates counterclockwise from the positive direction of the x-axis, and the unit of each angle is degrees.

Output

Output the maximum value of the total light intensity that surrounds all the target light sources in one line.

Examples

Input

1 90 10 20 3 3 1 90 10 315 10 6 0 1

Output

30

Input

2 90 10 10 -3 0 1 45 10 90 10 -6 0 2 30 3 180 10 -9 0 1

Output

10

inputFormat

input data such that the emitted light returns to the original light source. Also, in this problem, if the distance from the boundary of the area is within 0.000001, it is considered to be on the area.

Constraints

The input satisfies the following conditions.

  • All inputs consist of integers
  • 1 ≤ n ≤ 100
  • -1000 ≤ xi, yi ≤ 1000
  • 1 ≤ ri ≤ 1000
  • 1 ≤ θi ≤ 180
  • 1 ≤ αi ≤ 1000
  • 0 ≤ βi <360
  • 0 ≤ power, maxpoweri ≤ 1000

Input

n θ0 α0 power x1 y1 r1 θ1 α1 β1 maxpower1 .. .. xn yn rn θn αn βn maxpowern xn + 1 yn + 1 rn + 1

The number n of light sources excluding the target light source is given in the first line. The information on the coordinates (0,0) that first emit light on the second line, the information on the unintended light source on the third to n + 2 lines, and the information on the target light source on the n + 3 lines are separated by blanks. Given. For each information, xi and yi are the coordinates of the center point of the light source, ri is the radius of the light source, θi is the angle at which the light spreads, αi is the radius of the light, and βi is the direction in which the light is heading. The power in the second line represents the intensity of the first emitted light, and the maxpoweri in the third to n + second lines represents the upper limit of the emitted light. The direction βi of light rotates counterclockwise from the positive direction of the x-axis, and the unit of each angle is degrees.

outputFormat

Output

Output the maximum value of the total light intensity that surrounds all the target light sources in one line.

Examples

Input

1 90 10 20 3 3 1 90 10 315 10 6 0 1

Output

30

Input

2 90 10 10 -3 0 1 45 10 90 10 -6 0 2 30 3 180 10 -9 0 1

Output

10

样例

2
90 10 10
-3 0 1 45 10 90 10
-6 0 2 30 3 180 10
-9 0 1
10