open System

let sumChar (ss: string) =
    Seq.map (Char.GetNumericValue >> int) ss |> Seq.sum

let [|N; A; B|] = stdin.ReadLine().Split(' ') |> Array.map int

[1..N]
|> Seq.map string
|> Seq.sumBy (fun c -> if A <= (sumChar c) && (sumChar c) <= B then int c else 0)
|> printf "%d"
