#CCBCHBAHAI0000060. Phần tử gần trung bình nhất (Element Closest to the Average)

    ID: 978 Loại: Thông thường 2000ms 256MiB Tried: 0 Đã chấp nhận: 0 Độ khó: 1 Đăng bởi: Nhãn>Programming language basicsStatic arraysIteration techniquesImplementation techniquesWorking with numbersInteger arithmetic

Phần tử gần trung bình nhất (Element Closest to the Average)

Element Closest to the Average (Phần tử gần trung bình nhất)

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem

Given integers a0,…,an−1a_0,\ldots,a_{n-1}, define

μ=1n∑i=0n−1ai.\mu=\frac1n\sum_{i=0}^{n-1}a_i.

Choose the smallest index pp minimizing ∣ap−μ∣|a_p-\mu|. Equivalently, with S=∑aiS=\sum a_i, compare

∣nai−S∣|n a_i-S|

using integer arithmetic. Print pp and apa_p.

Input

The first line contains nn. The second line contains nn integers aia_i.

Output

Print p a_p, where pp is the selected 0-based index.

Subtask

Subtask 1 (20 points): 1≤n≤101\le n\le10, ∣ai∣≤103|a_i|\le10^3.

Subtask 2 (30 points): 1≤n≤50001\le n\le5000, ∣ai∣≤106|a_i|\le10^6.

Subtask 3 (50 points): 1≤n≤2⋅1051\le n\le2\cdot10^5, ∣ai∣≤109|a_i|\le10^9.

Example

Input

5
1 4 8 10 12

Output

2 8

Explanation

The sample follows the definitions and rules above.