logo AlgoBeat OnlineJudge
登录 注册

#215724. [ICPC 2024 Jakarta R] ICPC Square

内存限制:1024 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

ICPC Square is a hotel provided by the ICPC Committee for the accommodation of the participants. It consists of floors (numbered from to ). This hotel has a very unique elevator. If a person is currently at floor , by riding the elevator once, they can go to floor if and only if is a multiple of and .

You are currently at floor . You want to go to the highest possible floor by riding the elevator zero or more times. Determine the highest floor you can reach.

输入格式

A single line consisting of three integers ( ).

输出格式

Output a single integer representing the highest floor you can reach by riding the elevator zero or more times.

样例

样例输入 1

64 35 3

样例输出 1

60

样例输入 2

2024 2023 1273

样例输出 2

1273

数据范围与提示

Explanation for the sample input/output #1

First, ride the elevator from floor to floor . This is possible because is a multiple of and . Then, ride the elevator from floor to floor . This is possible because is a multiple of and . Finally, ride the elevator from floor to floor . This is possible because is a multiple of and .