Quadratic Form
题号:NC209432
时间限制:C/C++/Rust/Pascal 5秒,其他语言10秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Bobo has a positive-definite matrix and an -dimension vector . He would like to find where

  • ,
  • is maximum.

It can be shown that , which is rational.
Find the value of .

输入描述:

The input consists of several test cases terminated by end-of-file.

The first line of each test case contains an integer n.
The i-th of the following n lines contains n integers .
The last line contains n integers .

*
*
*
* for any
*
* The sum of n does not exceed .

输出描述:

For each test case, print an integer which denotes the result.

示例1

输入

复制
2
1 0
0 1
0 0
2
1 0
0 1
1 1
2
8 4
4 3
1 1

输出

复制
0
2
623902721