Codeforces celebrates 10 years! We are pleased to announce the crowdfunding-campaign. Congratulate us by the link https://codeforces.com/10years.
×

Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

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.

No tag edit access

C. Shooting Gallery

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputOne warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize — big pink plush panda. The king is not good at shooting, so he invited you to help him.

The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The targets are points on this plane. Each target is described by it's coordinates *x*_{i}, and *y*_{i}, by the time of it's appearance *t*_{i} and by the number *p*_{i}, which gives the probability that Copa hits this target if he aims at it.

A target appears and disappears instantly, so Copa can hit the target only if at the moment *t*_{i} his gun sight aimed at (*x*_{i}, *y*_{i}). Speed of movement of the gun sight on the plane is equal to 1. Copa knows all the information about the targets beforehand (remember, he is a king!). He wants to play in the optimal way, which maximizes the expected value of the amount of hit targets. He can aim at any target at the moment 0.

Input

The first line contains integer *n* (1 ≤ *n* ≤ 1000) — amount of targets in the shooting gallery. Then *n* lines follow, each describing one target. Each description consists of four numbers *x*_{i}, *y*_{i}, *t*_{i}, *p*_{i} (where *x*_{i}, *y*_{i}, *t*_{i} — integers, - 1000 ≤ *x*_{i}, *y*_{i} ≤ 1000, 0 ≤ *t*_{i} ≤ 10^{9}, real number *p*_{i} is given with no more than 6 digits after the decimal point, 0 ≤ *p*_{i} ≤ 1). No two targets may be at the same point.

Output

Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10^{ - 6}.

Examples

Input

1

0 0 0 0.5

Output

0.5000000000

Input

2

0 0 0 0.6

5 0 5 0.7

Output

1.3000000000

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Feb/18/2020 05:26:08 (h1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|