Count sum of all digits This challenge is to write a program or script which counts the sum of all digits within the integers from 1 up to and including a given number.

Input, one positive integer.
Output, the sum of digits in that number and all smaller numbers.

Examples:

Input: 5 
Integer Sequence: 1, 2, 3, 4, 5
Sum of Digits: 1 + 2 + 3 +4 + 5 = 15

Input: 12
Integer Sequence: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 
Sum of Digits: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 0 + 1 + 1 + 1 + 2 = 51


To be clear, this is to count a sum of the digits - not the integers. For single-digit inputs, this will be the same. However, inputs larger than 10 will have different responses. This would be an incorrect response:

Input: 12
Output: 78


Another example, to show the difference:

Input: 10

Integer Sequence: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Sum of Integers (INCORRECT RESPONSE): 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55

Digit Sequence: 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 0
Sum of Digits (CORRECT RESPONSE): 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 0 = 46


A larger test case (CORRECT RESPONSE):

Input: 1000000
Output: 27000001


Rules &amp; Guidelines:


Submitted code must be a complete program or script - not just a function. If the code requires includes, imports, etc., they must be included in the posted code.  
The number must be input by the user - not hard-coded. Input may be received as a command-line argument, file, stdin, or any other means by which your language can take user input.
The code must be able to properly handle inputs at least up to (2^64)-1.
The code should only output the sum.
Submitted programs &amp; scripts should be user-friendly and not wasteful of computer resources (e.g.: they should not declare insanely-large arrays to hold every character). There is no strict bonus or penalty for this, but please be good programmers.


Scoring:

Primary scoring mechanism is by code length. Lower scores are better. The following bonuses and penalties also apply:


-25 Bonus if your code can handle all positive numbers, for example: 1234567891234567891234564789087414984894900000000
-50 Bonus if your code can handle simple expressions, for example 55*96-12. To qualify for this bonus, the code should handle + - / * (addition, subtraction, division, multiplication) operators and enforce order of operations. Division is regular integer division.

The given example (55*96-12) evaluates to 5268. Your code should return the same for either of those inputs - correct answer is 81393.

-10 Bonus if your code qualifies for the -50 bonus and can handle the ^ (exponent) operator.
-100 Bonus if your code qualifies for the -50 bonus and does not use eval or similar to handle expressions.
+300 Penalty if your code relies upon any web resources.
Mathematica 30-(10+50)= -30
Shortened by 4 chars thanks to ybeltukov.
Range@n returns the numbers from 1 through n.
Integerdigits@n breaks up each of those numbers into its digits.
Total[n,2] sums the digits.  The 2 is to allow summing across different levels, i.e. lists of lists.
IntegerDigits@Range@#~Total~2&amp;

Testing
IntegerDigits@Range@#~Total~2&amp;[12]


51

IntegerDigits@Range@#~Total~2 &amp;[1000000]


27000001


Expressions
IntegerDigits@Range@#~Total~2 &amp;[55*96 - 12]

55*96 - 12


81393
5268

IntegerDigits@Range@#~Total~2 &amp;[5268]


81393


IntegerDigits@Range@#~Total~2 &amp;[55*96^2 - 12]
55*96^2 - 12


12396621
506868

IntegerDigits@Range@#~Total~2 &amp;[506868]


12396621