102200: [AtCoder]ABC220 A - Find Multiple

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:11 Solved:0

Description

Score : $100$ points

Problem Statement

Print a number between $A$ and $B$ (inclusive) that is a multiple of $C$.

If there is no such number, print -1.

Constraints

  • $1 \leq A \leq B \leq 1000$
  • $1 \leq C \leq 1000$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$A$ $B$ $C$

Output

Print the answer.
If there is no number with the desired property, print -1.


Sample Input 1

123 456 100

Sample Output 1

200

300 or 400 would also be accepted.


Sample Input 2

630 940 314

Sample Output 2

-1

Input

题意翻译

输出一个数 $k$ 满足 $k \in [a,b],k \bmod c = 0$。 若没有该数字,输出 `-1`。 Translated by ShanCreeper.

Output

得分:100分

问题描述

打印一个在$A$和$B$(包括)之间的,能被$C$整除的数。

如果没有这样的数,打印-1

约束

  • $1 \leq A \leq B \leq 1000$
  • $1 \leq C \leq 1000$
  • 输入中的所有值都是整数。

输入

从标准输入以以下格式获取输入:

$A$ $B$ $C$

输出

打印答案。
如果没有满足要求的数,打印-1


样例输入1

123 456 100

样例输出1

200

300400也会被接受。


样例输入2

630 940 314

样例输出2

-1

加入题单

算法标签: