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

题目描述

Given 2 vectors , . Elements in same vector are unique. You can swap any 2 adjacent elements for any times, making new vectors are A' and B'. Vector C = A' + B', which means . You need to maximize the value of  in minimalist swaps.
Answer should mod by 10^8 + 7.

输入描述:

The first line is the quantity of elements in vector.
The following 2 lines are the elements in respective vectors.

输出描述:

One line with 2 integers, the MAX  and the MIN swap steps.
示例1

输入

复制
8
1 4 2 8 5 7 3 6
7 3 1 2 8 5 6 4

输出

复制
816 14

备注:

1 <= n <= 10^5
1 <= ai, bi <= 10^8