Points Division
时间限制: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 .
The i-th point has two weights a_i and b_i.
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 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 x_i, y_i, a_i, b_i.

*
*
* 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

输出

复制
10
3
26