#CCBCHBAHAI0000008. Hai đầu của mảng (Array Endpoints)

Hai đầu của mảng (Array Endpoints)

Array Endpoints

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

You are given an integer array aa of length nn with n≥1n \ge 1, indexed from 00 to n−1n-1. The first element is a0a_0 and the last element is an−1a_{n-1}. Print these two values in that order.

Input

  • The first line contains the integer nn, the number of array elements.
  • The second line contains exactly nn integers a0,a1,…,an−1a_0,a_1,\ldots,a_{n-1} in increasing index order.

Output

Print the two integers a0a_0 and an−1a_{n-1}, separated by one space.

Subtasks

Subtask 1 (20 points): n=1n=1, −9≤a0≤9-9 \le a_0 \le 9.

Subtask 2 (30 points): 2≤n≤202 \le n \le 20, 0≤ai≤1040 \le a_i \le 10^4 for every 0≤i<n0 \le i<n.

Subtask 3 (50 points): 1≤n≤10001 \le n \le 1000, −109≤ai≤109-10^9 \le a_i \le 10^9 for every 0≤i<n0 \le i<n.

Examples

Input

5
8 6 7 5 3

Output

8 3

Explanation

The first element is a0=8a_0=8. The last index is n−1=4n-1=4 and the last value is 33. Therefore the output is 8 3.