| In some of the old historical chronicles the Indict system of chronology was used. Instead of a year, this system uses three integers, called indict, circle to the Sun, and circle to the Moon. Let's denote them as indict, circleSun, circleMoon.
Each of these three integers has a unique range. indict is between 1 and 15, circleSun is between 1 and 28, and circleMoon is between 1 and 19 (all ranges are inclusive). Initially, at year 1, all three of these numbers are equal to 1. Every year, all three numbers increase by 1, and whenever a number exceeds its upper bound (15, 28, and 19, respectively), it is reset to 1. For example, in year 16, indict = 1, circleSun = 16, and circleMoon = 16.
Given the ints indict, circleSun, and circleMoon, return the earliest year that the three numbers can represent. Time starts at year 1, so the return value will never be less than 1. |