import java.util.*;
import java.lang.*;
import java.io.*;
class Main {
int sumMin, counter = 1;
Scanner scanner
= new Scanner
(System.
in); int m = scanner.nextInt();
int n = scanner.nextInt();
sumMin = sumOfDigits(m);
for(int i = m + 1; i <= n; i++) {
if (sumOfDigits(i) < sumMin) {
sumMin = sumOfDigits(i);
counter = 1;
} else if (sumOfDigits(i) == sumMin)
counter++;
}
}
public static int sumOfDigits(int a){
int sum = 0;
while (a > 0) {
sum += a%10;
a /= 10;
}
return sum;
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgoKY2xhc3MgTWFpbiB7CgkKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbiB7CgkJCgkJaW50IHN1bU1pbiwgY291bnRlciA9IDE7CgkJCgkJU2Nhbm5lciBzY2FubmVyID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKCQlpbnQgbSA9IHNjYW5uZXIubmV4dEludCgpOwoJCWludCBuID0gc2Nhbm5lci5uZXh0SW50KCk7CgkJCgkJc3VtTWluID0gc3VtT2ZEaWdpdHMobSk7CgkJCgkJZm9yKGludCBpID0gbSArIDE7IGkgPD0gbjsgaSsrKSB7CgkJCWlmIChzdW1PZkRpZ2l0cyhpKSA8IHN1bU1pbikgewoJCQkJc3VtTWluID0gc3VtT2ZEaWdpdHMoaSk7CgkJCQljb3VudGVyID0gMTsKCQkJfSBlbHNlIGlmIChzdW1PZkRpZ2l0cyhpKSA9PSBzdW1NaW4pICAgCgkJICAgIGNvdW50ZXIrKzsKCQl9CgkJU3lzdGVtLm91dC5wcmludGxuKGNvdW50ZXIpOwoJfQoJCglwdWJsaWMgc3RhdGljIGludCBzdW1PZkRpZ2l0cyhpbnQgYSl7CgkJaW50IHN1bSA9IDA7CgkJd2hpbGUgKGEgPiAwKSB7CgkJCXN1bSArPSBhJTEwOwoJCQlhIC89IDEwOwoJCX0KCXJldHVybiBzdW07Cgl9Cn0=