Find the Hanyang Student ID!
Time limit1sMemory limit1024 MB
Given up to five Suneung standard scores, compute the Hanyang student ID from a fixed formula of score differences and products.
- Level
Easy2 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
I am Kim Hanyang. After seven attempts at the Suneung, I was admitted to Hanyang University with the class of 2023. While celebrating the acceptance call with friends over drinks, I walked off the road and rolled down a hill. When I woke up, two weeks had passed, and only 15 minutes remained before course registration opened. I got to the registration website, but the injury has left me unable to remember my student ID. The university notice explains how student IDs are generated.
Hanyang University is called the Engine of Korea, so its student IDs follow a special formula. To find the ID, you need the exact Suneung scores (standard scores).
- If the Korean score is higher than the English score, multiply the difference of the two scores by the building number of the Humanities Building. Otherwise, multiply the difference of the two scores by the building number of the International Building.
- If the math score is higher than the inquiry score, multiply the difference of the two scores by the building number of the 1st Engineering Building. Otherwise, multiply the difference of the two scores by the building number of the ITBT Building.
- If the second foreign language was taken, multiply its score by , the building number of Haengwon Park.
- Add the three values above, then multiply the sum by the Hanyang University postal code . The result is the student ID.
Kim Hanyang tried these calculations but found that the head injury makes mental arithmetic impossible. Write a program that calculates the student ID for him. A subject cannot be taken unless the subject before it was taken, and the standard score of a subject that was not taken is .
Input
The first line contains an integer , the number of subjects Kim Hanyang took. The second line contains integers, the standard scores of each subject, separated by spaces. The scores are given in the order Korean, math, English, inquiry, and second foreign language. The inquiry score is the sum of the standard scores of its two subjects. Every score is an integer from to , inclusive.
Output
Print Kim Hanyang's student ID.