时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld
题目描述
Bobo has a set P of n distinct points
%2C%20(x_2%2C%20y_2)%2C%20%5Cdots%2C%20(x_n%2C%20y_n))
.
The i-th point has two weights

and

.
He wants to partition the points into two sets A and B (That is,

and

.
A partition (A, B) is valid if and only if there exists no

and

where

and

.
Find the maximum of
%20%2B%20%5Cleft(%5Csum_%7Bj%20%5Cin%20B%7D%20b_j%5Cright))
among all valid partitions (A, B).
输入描述:
The input consists of several test cases and is terminated by end-of-file.
The first line of each test cases contains an integer n.
The i-th of the following n lines contains four integers
.
* 
* 
*
for all 
* The sum of n does not exceed
.
输出描述:
For each test case, print an integer which denotes the result.
示例1
输入
复制
2
1 2 1 9
2 1 9 1
1
1 1 2 3
4
1 1 1 5
1 2 2 6
2 1 3 7
2 2 4 8