F. 【例50.3】 平衡数

    Type: RemoteJudge 1000ms 64MiB

【例50.3】 平衡数

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

说明

平衡数:如果正整数 xx 的每一位数字 dd 恰好在 xx 中出现了 dd 次,则认为 xx 是平衡数。例如 x=122x=122,其中
对于百位数 d=1d = 1,其中 11 在 122122 中总共出现了 11 次,符合条件;
对于十位数 d=2d = 2,其中 22 在 122122 中总共出现了 22 次,符合条件;
对于个位数 d=2d = 2,其中 22 在 122122 中总共出现了 22 次,符合条件;
因为 122122的每一位都符合条件,所以 122122是平衡数。
现在给出两个正整数l和r(l≤r)l和r(l≤r),请帮忙求出l到rl 到r中所有平衡数的和。

输入格式

输入共一行,两个以空格隔开的正整数 l和rl和r(1≤l≤r≤100001≤l≤r≤10000)。

输出格式

输出共一行,一个整数,表示l∼rl\sim r 中所有平衡数的和。

样例

1 25
23