eolymp
bolt
Try our new interface for solving problems
Problems

Guards

Guards

Agency of CriminalMatters (ACM) provides protection for corporate offices. The agency employs security guards that work in \textbf{12} hours shifts. Every \textbf{24} hours day consists of a \textbf{12} hours \textit{daylight shift} and \textbf{12} hours \textit{nighttime shift} (day starts with a daylight shift). Security guards are hired to work on different schedules. Some schedules are simply periodic (certain pattern repeats in a specified number of days), while others are weekly (with a standard 7 days week) or depend on the day of the week. For this purpose Monday through Friday are considered to be \textit{workdays}; Saturday and Sunday are considered to be\textit{ weekends}. Each security guard works on one of the following four schedules: 1. Day of work (daylight and nighttime shifts) and two days (daylight and nighttime) of rest -- work every third day. \includegraphics{https://static.e-olymp.com/content/c3/c3c9b8b5e7116a23fda4a399fa699d560e278dcf.jpg} 2. Only daylight shifts on \textbf{5} workdays of a week (no work in nighttime and weekends). \includegraphics{https://static.e-olymp.com/content/ab/ab0810b8df990f3c395f366de9e81f57b6a27b1d.jpg} 3. Day of work (daylight and nighttime), day of rest (daylight and nighttime), daylight shift of work, nighttime of rest, and one more day (daylight and nighttime) of rest --- \textbf{3} shifts of work every \textbf{4} days. \includegraphics{https://static.e-olymp.com/content/29/29a5ab84203a305504613ea15de84ca2efc5699a.jpg} 4. Day of work (daylight and nighttime), day of rest (daylight and nighttime), day of work only during daylight (rest during nighttime), day of work (daylight and nighttime), day of rest (daylight and nighttime); but if any daylight shift falls on the weekend then it is cancelled --- \textbf{3} daylight shifts and \textbf{2} nighttime shifts every \textbf{5} days with the exception of weekends (where only nighttime shifts are possible). \includegraphics{https://static.e-olymp.com/content/46/46f165310385277da1ac1a8512a7786397353200.jpg} ACM has to provide protection for a location based on the following requirements. There has to be at least a certain number of guards during daylight shifts on workdays, at least a certain number of guards during daylight shifts on weekends, and at least a certain number of guards during nighttime shifts (it does not matter whether it is a workday or a weekend). As an additional requirement (for simplicity of planning) the schedule of protection for every location has to be\textit{regular}. In a regular schedule there is a fixed number of guards that work on any particular schedule during every daylight workday shift, nighttime workday shift, daylight weekend shift, and nighttime weekend shift. For example, if\textbf{4} guards on the 1st schedule work on some daylight workday shift, then \textbf{4} guards on the 1st schedule work on all daylight workday shifts (they might be different persons, though). Your task is to determine the minimal number of guards that have to be hired for protection of the specific location given its requirements. \InputFile The input file consists of a line with three integer numbers --- \textbf{n_1}, \textbf{n_2}, and \textbf{n_3} (\textbf{1} ≤ \textbf{n_1}, \textbf{n_2}, \textbf{n_3} ≤ \textbf{1000}). Here \textbf{n_1} is the minimum required number of guards during daylight shifts on workdays, \textbf{n_2} is the minimum required number of guards during daylight shifts on weekends, and \textbf{n_3} is the minimum required number of guards during nighttime shifts. \OutputFile Write to the output file a single line with four integer numbers --- \textbf{m_1}, \textbf{m_2}, \textbf{m_3}, and \textbf{m_4}. Here \textbf{m_i} is the number of security guards working on \textbf{i}-th schedule that are needed to establish security of a location with the given requirements. You have to write an answer that requires minimal number of guards in total, choosing any answer among those.
Time limit 1 second
Memory limit 64 MiB
Input example #1
100 99 99
Output example #1
285 0 8 5