Midterm Exam Grading

Given point values for N problems and each examinee's O/X results, find the highest scorer, breaking ties by the smallest exam number.

Easy2ImplementationArrayBrute forceInterviewNo attempts yetTime limit1sMemory limit512 MB

Problem

This midterm exam had NN problems, and MM people took it. Given the point value of each problem and the grading result of each examinee, write a program that finds the examinee with the highest score.

Input

The first line contains the number of problems NN and the number of examinees MM. (1N1001 \le N \le 100, 1M1001 \le M \le 100)

The second line contains the point values of problem 1 through problem NN in order. Each point value is a natural number no greater than 100, and the values are separated by spaces.

Each of the next MM lines contains the information of one examinee. Each of those lines holds N+1N+1 strings separated by spaces. The first string is the examinee's exam number, a natural number no greater than 100,000. The second through (N+1)(N+1)-th strings are the grading results for problem 1 through problem NN in order, and each one is either O or X. O means the examinee answered that problem correctly, and X means the examinee answered it incorrectly.

The point value of a problem answered correctly is added to the score, and the point value of a problem answered incorrectly is not added. No exam number appears twice.

Output

On the first line, print the exam number of the examinee with the highest score and that score, separated by a space. If several examinees have the highest score, print the one with the smallest exam number.