The Agency of Criminal Matters (ACM) protects corporate offices with security guards who work 12-hour shifts. Every 24-hour day is split into a 12-hour daylight shift followed by a 12-hour nighttime shift, and each day begins with the daylight shift. Monday through Friday are workdays; Saturday and Sunday are weekends.
Each guard is assigned to exactly one of the following four schedules.
Schedule 1 — one full day of work (both the daylight and the nighttime shift) followed by two full days of rest; the guard works one day out of every three. It cycles regardless of the day of the week.
Schedule 2 — daylight shifts only, on all five workdays of the week; never at night and never on weekends. This schedule is tied to the days of the week.
Schedule 3 — a 4-day cycle: day 1 work (daylight and nighttime), day 2 rest, day 3 daylight only (rest at night), day 4 rest; three worked shifts every four days. It cycles regardless of the day of the week.
Schedule 4 — a 5-day cycle: day 1 work (daylight and nighttime), day 2 rest, day 3 daylight only, day 4 work (daylight and nighttime), day 5 rest. However, any daylight shift that would fall on a weekend is cancelled, so only nighttime shifts occur on weekends. It cycles regardless of the day of the week.
The protection requirements are:
To simplify planning, the protection schedule must be regular: for each of the four schedules the number of guards on duty is the same integer constant across every daylight-workday shift, every nighttime-workday shift, every daylight-weekend shift, and every nighttime-weekend shift. (For example, if 4 guards on schedule 1 are on duty during one daylight workday shift, then 4 guards on schedule 1 are on duty during every daylight workday shift, though they may be different people.) A head count is a number of people, so it is always a non-negative integer.
Determine the minimum total number of guards that must be hired so that all requirements are met.
One line with three integers $n_1$, $n_2$, $n_3$ ($1 \le n_1, n_2, n_3 \le 1000$), separated by spaces. Here $n_1$ is the minimum number of guards required during daylight shifts on workdays, $n_2$ during daylight shifts on weekends, and $n_3$ during nighttime shifts.
Print a single integer: the minimum total number of guards that must be hired to meet all requirements.