P4057 [Code+#1] Morning Run

Description

"Without sports, there is no Tsinghua." "Exercise one hour a day, work healthily for fifty years, live a happy life for a lifetime." At Tsinghua, sports are an indispensable part of students' lives. To respond to the school's call, model student Captain Wang decides to stick to morning runs. However, for various reasons, getting up early to run every day is not realistic, so Captain Wang decides to run once every $a$ days. In other words, if Captain Wang gets up early to run on a certain day, he will rest for $a-1$ days afterward, then run again on the $a$-th day, and so on. Inspired by Captain Wang's persistence, his good friends Xiao Qin and Xiao Zhen also decide to keep up with morning runs. To suit their own situations, Xiao Qin decides to run once every $b$ days, and Xiao Zhen decides to run once every $c$ days. One morning, Captain Wang, Xiao Qin, and Xiao Zhen meet during their early run. They are very excited, encourage each other, and complete a perfect morning run together. For convenience, we label this meeting day as day $0$. Assuming the time window and route of each morning run are the same, they want to know on which day they will meet again while running. Since none of them can do the math, they ask you to tell them the answer.

Input Format

The input consists of one line containing three positive integers $a$, $b$, $c$, meaning Captain Wang runs every $a$ days, Xiao Qin runs every $b$ days, and Xiao Zhen runs every $c$ days.

Output Format

Output one line containing a positive integer $x$, indicating that the next time the three students meet will be on day $x$.

Explanation/Hint

![](https://cdn.luogu.com.cn/upload/pic/12819.png) From the CodePlus 2017 November Contest, presented with honor by the Student Algorithm and Programming Contest Association of the Department of Computer Science and Technology, Tsinghua University. Credit: idea/He Haotian, problem setting/He Haotian, verification/Lu Zhengrong. Git Repo: https://git.thusaac.org/publish/CodePlus201711 Thanks to Tencent for supporting this contest. Translated by ChatGPT 5