var
	B, D: array [0..20] of int64;

function count(x: int64; y: longint): int64;
var
	a: array [0..20] of longint;
	n, t, i, j: longint;
	result: int64;
begin
	result := 0;
	n := 0;
	if x = 0 then
	begin
		count := result;
		exit;
	end;
	repeat
		a[n] := x mod 10;
		inc(n);
		x := x div 10;
	until x <= 0;
	t := 0;
	for i := n - 1 downto 0 do
	begin
		for j := 0 to a[i] - 1 do
		begin
			if j = y then inc(t);
			inc(result, D[i] + t * B[i]);
			if j = y then dec(t);
		end;
		if a[i] = y then inc(t);
	end;
	inc(result, t);
	count := result;
end;

var
	result, x, y: int64;
	i: longint;
	
begin
//	assign(input, 'B.in'); reset(input);
//	assign(output, 'B.out'); rewrite(output);
	
	readln(x, y);

	B[0] := 1;
	for i := 1 to 12 do
	begin
		B[i] := B[i - 1] * 10;
	end;
	D[0] := 0;
	D[1] := 1;
	for i := 2 to 12 do
	begin
		D[i] := D[i - 1] * 10 + B[i - 1];
	end;

	result := 0;
	for i := 1 to 9 do
	begin
		inc(result, (count(y, i) - count(x - 1, i)) * i);
	end;
	
	writeln(result);
	
	close(output);
end.
