Program HOC24;
var m,n,i: byte;
t,d,code: integer;
s,st: string;
begin
write('Nhap N: '); readln(n);
m:=0;
for i:=1 to n do
begin
str(i,s);
st:=st+s;
end;
t:=0;
for i:=1 to n do
begin
val(st[i],d,code);
t:=t+d;
end;
write(t);
readln
end.
program tong;
uses crt;
var n, i, a : integer; x, s : string;
begin
clrscr;
write('nhap n= '); readln(n);
for i:=1 to n do
begin
str(i,s);
x:=x+s;
if length(x)=n then break
end;
{tim n so trong day}
for i:=1 to length(x) do
begin
val(x[i],n);
a:=a+n;
end;
{tinh tong n so trong day}
writeln('tong la ',a);
end.