process.stdin.resume();
process.stdin.setEncoding('utf8');
function countNumber(num) {
let count = 0;
while (num > 0) {
const digit = num % 10;
// if (digit === 6) {
if (digit === 3 || digit === 6|| digit === 9) {
count++;
}
num = Math.floor(num / 10);
}
return count;
}
function countInRange(first, last){
let count = 0;
for(let i = first; i< last; i++){
count+=countNumber(i)
}
return count
}
var remainder = ''
process.stdin.on('data', function (chunk) {
const input = chunk.toString().split(' ')
console.log(input[0], input[1])
const result = countInRange(Number(input[0]), Number(input[1]))
console.log(result)
});
cHJvY2Vzcy5zdGRpbi5yZXN1bWUoKTsKcHJvY2Vzcy5zdGRpbi5zZXRFbmNvZGluZygndXRmOCcpOwoKZnVuY3Rpb24gY291bnROdW1iZXIobnVtKSB7CiAgbGV0IGNvdW50ID0gMDsKICB3aGlsZSAobnVtID4gMCkgewogICAgY29uc3QgZGlnaXQgPSBudW0gJSAxMDsKICAgIC8vIGlmIChkaWdpdCA9PT0gNikgewogICAgaWYgKGRpZ2l0ID09PSAzIHx8IGRpZ2l0ID09PSA2fHwgZGlnaXQgPT09IDkpIHsKICAgICAgY291bnQrKzsKICAgIH0KICAgIG51bSA9IE1hdGguZmxvb3IobnVtIC8gMTApOwogIH0KICByZXR1cm4gY291bnQ7Cn0KIAogCmZ1bmN0aW9uIGNvdW50SW5SYW5nZShmaXJzdCwgbGFzdCl7CiAgICBsZXQgY291bnQgPSAwOwogICAgZm9yKGxldCBpID0gZmlyc3Q7IGk8IGxhc3Q7IGkrKyl7CiAgICAgICAgY291bnQrPWNvdW50TnVtYmVyKGkpCiAgICB9CiAgICByZXR1cm4gY291bnQKfQoKdmFyIHJlbWFpbmRlciA9ICcnCnByb2Nlc3Muc3RkaW4ub24oJ2RhdGEnLCBmdW5jdGlvbiAoY2h1bmspIHsKCWNvbnN0IGlucHV0ID0gY2h1bmsudG9TdHJpbmcoKS5zcGxpdCgnICcpCgljb25zb2xlLmxvZyhpbnB1dFswXSwgaW5wdXRbMV0pCgljb25zdCByZXN1bHQgPSBjb3VudEluUmFuZ2UoTnVtYmVyKGlucHV0WzBdKSwgTnVtYmVyKGlucHV0WzFdKSkKCWNvbnNvbGUubG9nKHJlc3VsdCkKfSk7