题库练习 Find a Number
← 上一题 下一题 →

A12250 | Find a Number

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

You are given two positive integers $d$ and $s$ . Find minimal positive integer $n$ which is divisible by $d$ and has sum of digits equal to $s$ .

输入格式

The first line contains two positive integers $d$ and $s$ ( $1 \le d \le 500, 1 \le s \le 5000$ ) separated by space.

输出格式

Print the required number or -1 if it doesn't exist.

输入输出样例

输入 #1
13 50
输出 #1
699998
输入 #2
61 2
输出 #2
1000000000000000000000000000001
输入 #3
15 50
输出 #3
-1
C++ 编辑器
输入
输出