GUANGGUN - 111…1 Squared


We call an integer Sticks if its decimal representation contains only digit 1.

Let S(n) be the sticks with n digits, find the sum of digits of S(n)2

For example, S(9)2=12345678987654321, its sum of digits is 81.

Input

Each line contains an integer represents n(1 ≤ n ≤ 1018).

Input is terminated by EOF, and contains at most 100 lines.

Output

For each n, print an integer represents the answer.

Example

Input:
9
10

Output:
81
82

hide comments
tushargiri007: 2019-01-18 13:20:15

see pattern .liitle help from spoojtoolkit
just 7 lines code

sanyam19: 2018-06-19 11:24:09

just 4 line of code... :) just try to observe d pattern ..

n_o_o_b_i_e: 2018-06-17 12:44:36

take care of that eof condition

sinersnvrsleep: 2018-04-22 15:09:42

hats off to problem setter nice pattern

sandeep_4141: 2017-06-09 18:25:53

10 to 11 line code in c++

kass_97: 2017-01-06 13:00:01

Not much to do in this problem, just observe the pattern

aditya_rev: 2016-11-15 06:36:00

only 2 lines logic code:)

Amey Telawane: 2013-08-10 20:35:34

take pen and paper to get it accepted


Added by:Bin Jin
Date:2011-11-11
Time limit:0.200s
Source limit:4096B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64