Problem: Its NU-Tech'15 and participants are pouring in large numbers. Its the first day of the fest and everybody has gathered around the registration desks but are confused on receiving a set of very large numbers on the registration slip. They are later told by the volunteers that in order to get their respective registration numbers, they are supposed to add all the numbers, then add the digits of the sum and the then again add the digits of the new sum and continue till the answer consists of a single digit. That digit is their Registration ID. Help the participants to decipher their NU-Tech Ids.

Input:

First line contains an integer n. n lines follow each containing a "Large Number".

Output:

Print the Registration IDs of the student.

Constraints:

1 ≤ n ≤500

1 ≤ Large Number ≤ 2^1000

SAMPLE INPUT
2
23
99

SAMPLE OUTPUT
5

Solution (in PYTHON):

Solution:
n = input(); s = 0;
while(n > 0):
	no = input(); s += no; n -= 1;
while(s >= 10):
	r = 0;
	while(s > 0):
		r += (s % 10);
		s /= 10;
	s = r;
print s;