ICPC
Time limit2sMemory limit512 MB
Given the four goal counts from two-legged finals, apply aggregate scores and the away goals tiebreak to name the winner or output Penalty.
- Level
Easy3 of 10
- Topics
- Implementation, Math, Simulation
- Solved
- No attempts yet
Problem
The Iranian ChamPions Cup (ICPC), the most prestigious football league in Iran, is reaching its end, and people are eagerly waiting for the finals. The finals happen to be between the two most popular Iranian teams, Persepolis and Esteghlal.
The ICPC finals consist of two matches, with each team competing as the home team in one match. The winning team is determined by aggregate score, the sum of the scores of the two matches. For example, if the scores of the two matches are Persepolis 6-0 Esteghlal in the first match and Esteghlal 3-1 Persepolis in the second match, then the aggregate score is Persepolis 7-3 Esteghlal, meaning Persepolis is the winner. If the aggregates are equal, the away goals rule determines the winner: the team that scored the most goals in the match it played away from home. If the result is still equal, a penalty shootout is required.
Hana, an avid football fan, is trying to figure out various scenarios in which her favorite team wins the finals. To this end, she wants to write a program that gets as input the number of goals in the two matches and decides which team is the winner if that can be derived from the aggregate scores and the away goals rule, and otherwise declares that the match goes to penalty kicks. You are going to help Hana write such a program.
Input
The first line of the input contains two space-separated integers p1 and s1, where p1 and s1 are the number of goals scored by Persepolis and Esteghlal, respectively, in the first match, in which Persepolis is the home team. The second line contains two space-separated integers s2 and p2, where s2 and p2 are the number of goals scored by Esteghlal and Persepolis, respectively, in the second match, in which Esteghlal is the home team. All input integers are between 0 and 20, inclusive.
Output
If the winner can be determined by the aggregate scores and the away goals rule, print the name of the winning team, either Persepolis or Esteghlal. Otherwise, print Penalty.