Yalda
Time limit1sMemory limit2048 MB
Given a budget and three prices, the task is to print the first item in the preference list (watermelon, pomegranates, nuts) that the budget covers, or Nothing.
- Level
Easy1 of 10
- Topics
- Implementation
- Solved
- No attempts yet
Problem
Yalda is an ancient Persian celebration held on the longest night of the year, the winter solstice. The word Yalda comes from Syriac and means birth, marking the rebirth of the sun as the days slowly grow longer after the solstice.
On Yalda night, Iranian families gather to spend the night telling stories, reading poetry (especially works by Persian poets such as Hafez), and enjoying each other's company. Traditional items include:
- Watermelon: represents the warmth of summer and keeps away winter's chill.
- Pomegranates: symbolize the cycle of life and prosperity.
- Nuts: a treat that stands for abundance and blessings.
Mahya is busy organizing the ICPC regional contest and has missed celebrating Yalda night with her family. She does not want to miss out entirely, so she plans to celebrate with friends at the university. To make the gathering more festive, Mahya wants to buy exactly one traditional item. Her budget is limited, so she must choose carefully.
The item is chosen by price and her preferences. Watermelon is her first choice, pomegranates the second, and nuts the third. If her budget does not allow any of the items, she skips the purchase.
Input
The first line contains an integer (), Mahya's budget in Rials.
The next three lines contain the prices of watermelon, pomegranates, and nuts, in that order. Each price is a non-negative integer not exceeding .
Output
Print the name of the first item Mahya can afford from her preference list: "Watermelon", "Pomegranates", or "Nuts". If her budget is not sufficient for any of the items, print "Nothing".