logo AlgoBeat OnlineJudge
登录 注册

#210716. [HBCPC2024] Points on the Number Axis A

内存限制:256 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Alice is playing a single-player game on the number axis.

There are points on the number axis. Each time, the player selects two points. The two points will be removed, and their midpoint will be added. When there is only one point on the axis, the game ends. Formally, if the two chosen points is and , then will be added after the operation.

In order to play this game happily, Alice will always select two points randomly.

Now Alice have a question: where is the expected position of the last point.

It can be proven that the answer can be expressed in the form , you only need to output the value of .

输入格式

The first line contains one integer ().

The second line contains integers (), denoting the position of the -th point.

Note that two points may be in the same position.

输出格式

Output one integer, the answer modulo .

样例

样例输入 1

3
1 2 4

样例输出 1

332748120