Good Bye 2015
G
New Year and Cake
Codeforces
2900
原题
← FH →
翻译中…

Limak is a little polar bear. According to some old traditions, his bear family prepared a New Year cake. And Limak likes cakes.

翻译中…

As you may know, a New Year cake is a strictly convex polygon with $*n*$ vertices.

翻译中…

Parents won't allow Limak to eat more than half of a cake because he would get sick. After some thinking they decided to cut a cake along one of $*n*·(*n* - 3) / 2$ diagonals. Then Limak will get a non-greater piece.

翻译中…

Limak understands rules but he won't be happy if the second piece happens to be much bigger. Limak's disappointment will be equal to the difference between pieces' areas, multiplied by two. It can be proved that it will be integer for the given constraints.

翻译中…

There are $*n*·(*n* - 3) / 2$ possible scenarios. Consider them all and find the sum of values of Limak's disappointment, modulo $10^{9} + 7$.

翻译中…

Input

翻译中…

The first line of the input contains a single integer $*n*$ ($4 ≤ *n* ≤ 500 000$) — the number of vertices in the polygon denoting the cake.

翻译中…

Each of the next $*n*$ lines contains two integers $*x*_{*i*}$ and $*y*_{*i*}$ ($|*x*_{*i*}|, |*y*_{*i*}| ≤ 10^{9}$) — coordinates of the $*i*$-th point.

翻译中…

It's guaranteed that all points are distinct, polygon is strictly convex and points are given in the clockwise order.

翻译中…

Output

翻译中…

Print the sum of values of Limak's disappointment over all possible scenarios modulo $10^{9} + 7$.

翻译中…

Note

翻译中…

In the first sample possible values of Limak's disappointment are $0, 18, 18, 24, 30$.

翻译中…

样例

Input #1
5
2 4
2 7
5 7
5 4
3 -2
Output #1
90
InputCopy OutputCopy
Input #2
4
-1000000000 -5000000
0 1234567
1 1
-5 -100000000
Output #2
525185196
InputCopy OutputCopy
Input #3
8
-10 0
-6 6
0 10
6 6
10 0
6 -6
0 -10
-6 -6
Output #3
5216
InputCopy OutputCopy
题目信息
题号
611G
所属比赛
时间限制
2 s
内存限制
256 MB
标签
计算几何
双指针

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。