测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A12250. Find a Number

编程题 普及/提高-

题目描述

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
上一题 去做题 下一题