### Problem Statement

You are a geek with so many geeky friends that you sometimes forget about their birthdays. So, you've decided to write a program that will remind you about such recurring events. Since your friends are geeks, they may celebrate occasions other than their actual birthdays. For example, they might celebrate whenever their age in days becomes divisible by 1000.

You are given a String[] friendNames and a int[] birthDates. Your i-th friend is named friendNames[i] and was born on birthDates[i]. All dates in this problem are non-negative integers representing the number of days that have elapsed since day 0.

The occasions celebrated by all your friends are given in the String[] occasions and int[] days. Occasion i is named occasions[i]. Each of your friends celebrates that occasion on each date b+n*day[i], where b is that friend's birth date and n is an integer greater than or equal to 1. For example, if a friend was born on day 10, and there's an occasion that is celebrated every 4 days, that friend would celebrate it on day 14, day 18, day 22, etc.

Today's date is given as an int currentDate. Your task is to generate the next k occasions that will be celebrated by your friends (starting from today). Return these occasions in a String[] where each element represents a single occasion formatted as "DATE. FRIEND OCCASION (NUMBER)" (quotes for clarity). Each DATE is the date of the occasion with no extra leading zeroes, FRIEND is the name of the friend, OCCASION is the name of the occasion, and NUMBER is the number of the occasion (1 is the first time the occasion has happened since that person's birth date, 2 is the second time, etc.). The String[] should be sorted in chronological order from earliest to latest. If multiple occasions happen on the same day, order them by occasion (occasions that appear earlier in occasions and days should be listed earlier), breaking ties by friend (friends that appear earlier in friendNames and birthDates should be listed earlier).

### Definition

 Class: BirthdayReminders Method: remind Parameters: String[], int[], int, String[], int[], int Returns: String[] Method signature: String[] remind(String[] friendNames, int[] birthDates, int currentDate, String[] occasions, int[] days, int k) (be sure your method is public)

### Constraints

-currentDate will be between 1 and 1000000, inclusive.
-friendNames will contain the same number of elements as birthDates.
-friendNames and birthDates will contain between 1 and 50 elements, inclusive.
-Each element of birthDates will be between 0 and currentDate-1, inclusive.
-occasions will contain the same number of elements as days.
-occasions and days will contain between 1 and 50 elements, inclusive.
-Each element of days will be between 1 and 1000000, inclusive.
-k will be between 1 and 100, inclusive.
-Each element of friendNames will contain only uppercase letters ('A' - 'Z'), lowercase letters ('a' - 'z'), and spaces.
-Each element of occasions will contain only uppercase letters ('A' - 'Z'), lowercase letters ('a' - 'z'), and spaces.

### Examples

0)

 `{"John", "Jack", "Bill"}` `{50, 100, 150}` `500` `{"birthday", "decimal birthday", "binary birthday"}` `{365, 1000, 512}` `10`
```Returns:
{"515. Bill birthday (1)",
"562. John binary birthday (1)",
"612. Jack binary birthday (1)",
"662. Bill binary birthday (1)",
"780. John birthday (2)",
"830. Jack birthday (2)",
"880. Bill birthday (2)",
"1050. John decimal birthday (1)",
"1074. John binary birthday (2)",
"1100. Jack decimal birthday (1)" }```
1)

 `{"Zero", "Two", "Three"}` `{0, 2, 3}` `24` `{"threeday", "twoday"}` `{3,2}` `10`
```Returns:
{"24. Zero threeday (8)",
"24. Three threeday (7)",
"24. Zero twoday (12)",
"24. Two twoday (11)",
"25. Three twoday (11)",
"26. Two threeday (8)",
"26. Zero twoday (13)",
"26. Two twoday (12)",
"27. Zero threeday (9)",
"27. Three threeday (8)" }```
 This demonstrates the sorting rules used.
2)

 `{"Jessica Alba", "Angelina Jolie", "Paris Hilton", "Britney Spears"}` `{4135, 1980, 4065, 4353}` `14091` `{"Venus year", "Earth year", "Mars year", "Jupiter year", "Saturn year"}` `{225, 365, 687, 4332, 10760}` `20`
```Returns:
{"14130. Angelina Jolie Venus year (54)",
"14190. Paris Hilton Venus year (45)",
"14208. Britney Spears Earth year (27)",
"14253. Britney Spears Venus year (44)",
"14260. Jessica Alba Venus year (45)",
"14285. Paris Hilton Earth year (28)",
"14346. Angelina Jolie Mars year (18)",
"14355. Angelina Jolie Venus year (55)",
"14355. Jessica Alba Earth year (28)",
"14370. Paris Hilton Mars year (15)",
"14390. Angelina Jolie Earth year (34)",
"14415. Paris Hilton Venus year (46)",
"14440. Jessica Alba Mars year (15)",
"14478. Britney Spears Venus year (45)",
"14485. Jessica Alba Venus year (46)",
"14573. Britney Spears Earth year (28)",
"14580. Angelina Jolie Venus year (56)",
"14640. Paris Hilton Venus year (47)",
"14650. Paris Hilton Earth year (29)",
"14658. Britney Spears Mars year (15)" }```

#### Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=8481

#### Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=13503&pm=8481

Eryx

#### Testers:

PabloGilberto , Olexiy , Andrew_Lazarev , ivan_metelsky

#### Problem categories:

Simple Math, Simple Search, Iteration