CF1517G Starry Night Camping

Description

At the foot of Liyushan Mountain, $ n $ tents will be carefully arranged to provide accommodation for those who are willing to experience the joy of approaching nature, the tranquility of the night, and the bright starry sky. The $ i $ -th tent is located at the point of $ (x_i, y_i) $ and has a weight of $ w_i $ . A tent is important if and only if both $ x_i $ and $ y_i $ are even. You need to remove some tents such that for each remaining important tent $ (x, y) $ , there do not exist $ 3 $ other tents $ (x'_1, y'_1) $ , $ (x'_2, y'_2) $ and $ (x'_3, y'_3) $ such that both conditions are true: 1. $ |x'_j-x|, |y'_j - y|\leq 1 $ for all $ j \in \{1, 2, 3\} $ , and 2. these four tents form a parallelogram (or a rectangle) and one of its sides is parallel to the $ x $ -axis. Please maximize the sum of the weights of the tents that are not removed. Print the maximum value.

Input Format

N/A

Output Format

N/A

Explanation/Hint

Here is an illustration of the second example. Black triangles indicate the important tents. This example also indicates all $ 8 $ forbidden patterns. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1517G/0fae62584a9770e97f438e651f4152ee158ac6e0.png)