generator 3
题号:NC51700
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Here is another simple problem: Given n points in the 2-dimensional plane, please calculate the area of the convex hull.

However, as you might already have guessed, the value of n is very large! So you'll use the following generator to generate all those points:

You are given nine integers x_0, y_0, a_x, a_y, b_x, b_y, p_x, p_y, n.
There are two recursive equations: and for all 0 < i < n.
The given n points are (x_i, y_i) for .

输入描述:

The input consists of only one line.
This line contains nine integers in the following order: x_0, y_0, a_x, a_y, b_x, b_y, p_x, p_y, n.

*

*

*

* There may be multiple points in the same position

输出描述:

Please output one integer denoting the area of the convex hull (of the generated n points) multiplied by 2.

It can be proved that two times such area is always an integer.
示例1

输入

复制
2 3 4 5 6 7 8 9 10

输出

复制
28
示例2

输入

复制
123 193 37 59 31 128 195777 193241 12345678

输出

复制
75659192744