拿行李(极限版) GCD - Extreme (II)

题目描述

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=26&page=show_problem&problem=2421 [PDF](https://uva.onlinejudge.org/external/114/p11426.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11426/7db7569be659bfab872ae0665f7c396b5f0a6b2c.png)

输入输出格式

输入格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11426/e8ca6ed1b9af4e7033c8c32899a727a0616d2252.png)

输出格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11426/1dc1907cd527b7bb02c97853c0627d2f4c4d849b.png)

输入输出样例

输入样例 #1

10
100
200000
0

输出样例 #1

67
13015
143295493160