#P1836. Sum of Digits of Book Pages
Sum of Digits of Book Pages
Sum of Digits of Book Pages
A book's page numbers are consecutive integers from \(1\) to \(n\). For example, page \(123\) has digits \(1+2+3=6\). Your task is to compute the sum of all individual digits that appear in the page numbers.
Example: If \(n = 123\), then the sum of digits for each page from \(1\) to \(123\) is calculated and summed up.
inputFormat
The input is a single integer \(n\) which represents the total number of pages in the book.
\(1 \leq n\)
outputFormat
Output a single integer, the sum of all digits from all page numbers \(1, 2, 3, \dots, n\).
sample
1
1