package main
import (
"fmt"
"sort"
)
var luckyNumbers []int64
func generateLuckyNumbers(current int64) {
if current > 10000000000 {
return
}
if current > 0 {
luckyNumbers = append(luckyNumbers, current)
}
generateLuckyNumbers(current*10 + 4)
generateLuckyNumbers(current*10 + 7)
}
func main() {
var l, r int64
fmt.Scan(&l, &r)
generateLuckyNumbers(0)
sort.Slice(luckyNumbers, func(i, j int) bool {
return luckyNumbers[i] < luckyNumbers[j]
})
var totalSum int64
currentL := l
for currentL <= r {
idx := sort.Search(len(luckyNumbers), func(i int) bool {
return luckyNumbers[i] >= currentL
})
lucky := luckyNumbers[idx]
end := lucky
if r < lucky {
end = r
}
count := end - currentL + 1
totalSum += count * lucky
currentL = end + 1
}
fmt.Println(totalSum)
}