Sometimes it is not easy to come to an agreement in a bargain. Right now Sasha and Vova can't come to an agreement: Sasha names a price as high as possible, then Vova wants to remove as many digits from the price as possible. In more details, Sasha names some integer price $n$, Vova removes a non-empty substring of (consecutive) digits from the price, the remaining digits close the gap, and the resulting integer is the price.

For example, is Sasha names $1213121$, Vova can remove the substring $1312$, and the result is $121$.

It is allowed for result to contain leading zeros. If Vova removes all digits, the price is considered to be $0$.

Sasha wants to come up with some constraints so that Vova can't just remove all digits, but he needs some arguments supporting the constraints. To start with, he wants to compute the sum of all possible resulting prices after Vova's move.

Help Sasha to compute this sum. Since the answer can be very large, print it modulo $10^9 + 7$.


-----Input-----

The first and only line contains a single integer $n$ ($1 \le n < 10^{10^5}$).


-----Output-----

In the only line print the required sum modulo $10^9 + 7$.


-----Examples-----
Input
107

Output
42

Input
100500100500

Output
428101984



-----Note-----

Consider the first example.

Vova can choose to remove $1$, $0$, $7$, $10$, $07$, or $107$. The results are $07$, $17$, $10$, $7$, $1$, $0$. Their sum is $42$.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Dynamic programming

Combinatorics

Mathematics


Solutions:
(n, mod, tot, loc) = (input().strip(), 10 ** 9 + 7, 0, 0)
for (i, c) in enumerate(n[::-1]):
	p = len(n) - 1 - i
	tot = (tot + p * (p + 1) // 2 * int(c) * pow(10, i, mod) + loc * int(c)) % mod
	loc = (loc + (i + 1) * pow(10, i, mod)) % mod
print(tot % mod)


import math
bign = 1000000007
a = input()
n = len(a)
g = [1] * n
gc = [1] * (n + 1)
gc[-1] = 0
h = [1] * (n + 1)
h[-1] = 0
hc = [1] * (n + 1)
hc[-1] = 0
for i in range(1, n):
	g[i] = g[i - 1] * 10 % bign
	h[i] = h[i - 1] * (i + 1) % bign
	gc[i] = (gc[i - 1] + (i + 1) * g[i]) % bign
	hc[i] = (hc[i - 1] + (i + 1)) % bign
ans = 0
for i in range(n):
	ans += int(a[i]) * gc[n - 2 - i] % bign
	ans %= bign
	ans += int(a[i]) * g[n - 1 - i] * hc[i - 1] % bign
	ans %= bign
print(ans)


Mod = 10 ** 9 + 7
T = str(input())
n = len(T)
substring = [0 for i in range(n)]
pow10 = [0 for j in range(n)]
pow10[0] = 1
for i in range(1, n):
	pow10[i] = pow10[i - 1] * 10 % Mod
for i in range(n - 1):
	substring[n - i - 2] = (substring[n - i - 1] + pow10[i] * (i + 1)) % Mod
count = 0
for i in range(n):
	total_string = i * (i + 1) / 2 % Mod
	contribution1 = int(total_string) * (int(T[i]) % Mod * pow10[n - i - 1]) % Mod
	contribution2 = int(T[i]) % Mod * substring[i] % Mod
	count += contribution1 + contribution2
print(int(count) % Mod)


s = input()
M = 10 ** 9 + 7
o = u = v = i = 0
n = len(s)
for c in s:
	c = int(c)
	u += v
	v = (10 * v + c) % M
	o += pow(10, n - i - 1, M) * ((i * i + i) // 2 * c + u)
	i += 1
print(o % M)


import sys
import math as mt
import bisect
t = 1
p = 10 ** 9 + 7
fact = [0] * 300001
inv = [0] * 300001

def ncr_util():
	inv[0] = inv[1] = 1
	fact[0] = fact[1] = 1
	for i in range(2, 300001):
		inv[i] = inv[i % p] * (p - p // i) % p
	for i in range(1, 300001):
		inv[i] = inv[i - 1] * inv[i] % p
		fact[i] = fact[i - 1] * i % p
ncr_util()

def ncr(n, r):
	return fact[n] * inv[n - r] % p * (inv[r] % p) % p

def solve():
	ans = 0
	p2 = [1] * (len(s) + 1)
	p10 = [1] * (len(s) + 1)
	p11 = [1] * (len(s) + 1)
	mul = 1
	for i in range(1, len(s) + 1):
		p2[i] = p2[i - 1] * 2 % p
		p10[i] = p10[i - 1] * 10 % p
		p11[i] = p11[i - 1] * 10 % p
	pref = [0] * (len(s) + 1)
	mul = 1
	for i in range(1, len(s) + 1):
		pref[i] = (pref[i - 1] + i * mul % p) % p
		mul = mul * 10 % p
	for i in range(len(s)):
		x = int(s[i])
		x1 = i
		x1 = x1 * (x1 + 1) // 2
		y1 = x * pref[len(s) - i - 1] % p
		x1 = x * x1 % p * p10[len(s) - i - 1] % p
		ans = (ans + x1 + y1) % p
	return ans
for _ in range(t):
	s = input()
	print(solve())


s = input()
mod = int(1000000000.0 + 7)
l = len(s)
(a, b) = (0, 0)
ss = s[::-1]
for i in range(l):
	c = int(ss[i])
	p = l - 1 - i
	a += p * (p + 1) // 2 * c * pow(10, i, mod)
	a += b * c
	a %= mod
	b += (i + 1) * pow(10, i, mod)
	b %= mod
print(a)


MOD = 1000000007

def power(a, b, m):
	ans = 1
	for i in range(b):
		ans = ans * a % m
	return ans
s = input()
n = len(s)
power10 = []
rev = []
for i in range(n):
	if i == 0:
		power10.append(1)
		rev.append(1)
	else:
		power10.append(power10[i - 1] * 10 % MOD)
		rev.append(((i + 1) * power10[i] + rev[i - 1]) % MOD)
ans = 0
for i in range(n):
	no = int(s[i])
	if no == 0:
		continue
	ld = i
	rd = int(n - ld - 1)
	lans = 0
	rans = 0
	if ld != 0:
		lans = ld * (ld + 1) // 2 % MOD
		lans = lans * power10[rd] % MOD
		lans = lans * no % MOD
	if rd != 0:
		rans = rev[rd - 1] * no % MOD
	ans += int(lans + rans)
print(ans % MOD)


s = input()
n = len(s)
mod = int(1000000000.0 + 7)
fans = 0
vals = [0]
p10 = 1
for i in range(1, n + 2):
	vals.append(vals[-1] + p10 * i % mod)
	p10 *= 10
	p10 %= mod
	vals[-1] %= mod
for (i, a) in zip(range(n), s):
	d = int(a)
	on_left = i
	on_right = n - i - 1
	fans += on_left * (on_left + 1) // 2 % mod * d * pow(10, n - i - 1, mod) % mod
	b = n - i - 1
	x = on_right - 1
	vv = vals[on_right] * d
	fans += vv % mod
	fans %= mod
print(int(fans))


import math
mod = 10 ** 9 + 7

def modInverse(b):
	return pow(b, mod - 2, mod)

def modDivide(a, b):
	a = a % mod
	inv = modInverse(b)
	return inv * a % mod

def solve():
	arr = list(map(int, list(input())))
	if len(arr) == 1:
		print(0)
		return 0
	t = 0
	l = len(arr)
	R = 0
	for i in range(l - 2, -1, -1):
		R += pow(10, l - i - 1 - 1, mod) * (l - i - 1) % mod
		R %= mod
		t += arr[i] * R % mod
		t %= mod
	for i in range(1, l):
		t += arr[i] * (i * (i + 1) // 2) % mod * pow(10, l - i - 1, mod) % mod
		t %= mod
	print(int(t) % mod)
solve()


import os
import sys
from io import BytesIO, IOBase
import threading
from bisect import bisect_right
from math import gcd, log
from collections import defaultdict
from pprint import pprint
from math import ceil
MOD = 10 ** 9 + 7

def main():
	s = input()
	su = 0
	sm = 0
	n = len(s)
	arr = [0] * n
	num = 0
	for i in range(n):
		dig = int(s[i])
		num = num * 10 + dig
		num %= MOD
		sm = sm + num
		sm %= MOD
		arr[i] = sm
	cnt = 0
	ans = 0
	dig = 0
	tp = 1
	for i in range(n - 1, -1, -1):
		ans = ans + dig * (i + 1) + tp * arr[i]
		dig = dig + tp * int(s[i])
		ans += dig
		tp *= 10
		tp %= MOD
		ans %= MOD
	ans = ans - dig * (n + 1)
	ans %= MOD
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(1):
	main()


s = str(input())
base = 1000000007
n = len(s)
f = [0] * (n + 1)
for i in range(1, n + 1):
	f[i] = i * (i + 1) // 2
t = [1] * (n + 1)
t[0] = 1
for i in range(1, n + 1):
	t[i] = t[i - 1] * 10 % base
p = [0] * (n + 1)
for i in range(1, n):
	p[i] = (i * t[i - 1] % base + p[i - 1]) % base
ans = 0
for i in range(n - 1, -1, -1):
	ans = (ans + int(s[i]) * f[i] * t[n - i - 1] % base + int(s[i]) * p[n - 1 - i] % base) % base
print(ans)


n = list(input())
l = len(n)
x = 1
y = 0
z = 0
mod = pow(10, 9) + 7
ans = 0
for i in range(l):
	m = int(n[l - i - 1])
	ans += x * m * ((l - i) * (l - i - 1) // 2)
	ans %= mod
	ans += z * m
	ans %= mod
	y += 1
	z += x * y
	z %= mod
	x *= 10
	x %= mod
print(ans)


def isSubsetSum(set, n, sum):
	if sum == 0:
		return True
	if n == 0 and sum != 0:
		return False
	if set[n - 1] > sum:
		return isSubsetSum(set, n - 1, sum)
	return isSubsetSum(set, n - 1, sum) or isSubsetSum(set, n - 1, sum - set[n - 1])
mod = 10 ** 9 + 7
res = 0
vect = 0
string = input()
string = string[::-1]
n = len(string)
for (i, dx) in enumerate(string):
	d = int(dx)
	res += pow(10, i, mod) * d * (((n - i - 1) * (n - i - 2) // 2 + (n - i - 1)) % mod)
	res %= mod
	if i > 0:
		vect += i * pow(10, i - 1, mod)
	vect %= mod
	res += d * vect
	res %= mod
print(res)


mod = 1000000007
s = list(map(int, input()))
n = len(s)
post = n * (n - 1) // 2 % mod
pre = 0
ans = 0
pos = 1
for i in range(n):
	ans = (ans + pre * s[n - i - 1]) % mod
	ans = (ans + post * pos * s[n - i - 1]) % mod
	pre = (pre + (i + 1) * pos) % mod
	post = (post - (n - i - 1)) % mod
	pos = pos * 10 % mod
print(ans % mod)


a = input()
ln = len(a)
ans = 0
mod = 10 ** 9 + 7
mul = [0] * ln
prev = 1
pow10 = [1] * ln
for i in range(ln):
	mul[i] = prev * (i + 1)
	if i > 0:
		mul[i] += mul[i - 1]
		pow10[i] = pow10[i - 1] * 10
		pow10[i] %= mod
	mul[i] %= mod
	prev *= 10
	prev %= mod
ans = 0
for i in range(ln):
	cur = i * (i + 1) // 2
	cur *= int(a[i])
	cur %= mod
	cur *= pow10[ln - i - 1]
	ans += cur % mod
	if i < ln - 1:
		ans += int(a[i]) * mul[ln - i - 2] % mod
	ans %= mod
print(ans % mod)


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
(*a,) = map(int, S())
sm = 0
val = 0
pst = 0
ans = 0
n = len(a)
for i in range(n):
	ans *= 10
	ans += sm - val
	ans += (i ** 2 + i) // 2 * a[i]
	sm += a[i] * (n - i - 1)
	val += pst
	pst += a[i]
	ans %= N
print(ans)


import sys
num = input()
n = len(num)
ans = 0
md = 1000000007
cc = [0]
ten = [1]
for i in range(n + 1):
	ten.append(ten[-1] * 10 % md)
	cc.append((cc[-1] + ten[i] * (i + 1)) % md)
for (i, a) in enumerate(num):
	a = int(a)
	ans += a * (cc[n - i - 1] + ten[n - i - 1] * i * (i + 1) // 2)
	ans %= md
print(ans)


import sys
input = sys.stdin.readline
m = 10 ** 9 + 7
n = input().strip('\n')
a = [int(i) for i in n]
n = len(n)
table = []
s = 0
for i in range(n):
	s = (s + (i + 1) * pow(10, i, m)) % m
	table.append(s)
s = 0
for i in range(n):
	x = n - i - 2
	if x >= 0:
		s += a[i] * table[x]
	s += i * (i + 1) // 2 * a[i] * pow(10, x + 1, m)
	s = s % m
print(s)


import sys
input = sys.stdin.readline

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input().strip()

def listStr():
	return list(input().strip())
import collections as col
import math
M = 10 ** 9 + 7

def triangle(j):
	return j * (j + 1) // 2 % M

def solve():
	N = [int(s) for s in input().strip()]
	len_N = len(N)
	ten_pows = col.defaultdict(int)
	ten_pows[0] = 1
	for j in range(1, len_N + 1):
		ten_pows[j] = ten_pows[j - 1] * 10 % M
	P = [N[0]]
	curr = N[0]
	for j in range(1, len_N):
		curr += N[j]
		curr %= M
		P.append(curr)
	ans = 0
	for j in range(1, len_N):
		tmp = (P[j - 1] * (len_N - j) + triangle(j) * N[j]) * ten_pows[len_N - j - 1]
		ans += tmp
		ans %= M
	return ans
print(solve())


n = list(map(int, list(input())))
l = len(n)
MOD = int(1000000000.0 + 7)
k = [pow(10, l - 1 - i, MOD) for i in range(l)]
s = [0]
for i in range(l - 1):
	s.append(s[-1])
	s[-1] += (i + 1) * k[l - i - 1]
	s[-1] %= MOD
print(sum([(d * k[i] * i * (i + 1) // 2 + d * s[l - 1 - i]) % MOD for (i, d) in enumerate(n)]) % MOD)


s = input()
ans = 0
mod = 10 ** 9 + 7
sufix = [0 for x in range(len(s))]
sufix[0] = 1
n = len(s)
ten = [1 for x in range(n + 1)]
for i in range(1, n + 1):
	ten[i] = ten[i - 1] * 10
	ten[i] %= mod
for i in range(len(s)):
	sufix[i] = ten[i] * (i + 1) + sufix[i - 1]
sufix = sufix[-1::-1]
sufix.append(0)
for i in range(len(s)):
	ans += i * (i + 1) // 2 * int(s[i]) * ten[n - i - 1]
	ans %= mod
	ans += int(s[i]) * sufix[i + 1]
	ans %= mod
print(ans)


MOD = 10 ** 9 + 7

def precompute_Mc(N):
	res = [0]
	current = 1
	s = 2
	for i in range(N):
		res.append(current)
		current += s
		s += 1
	return res

def precompute_Ms(N):
	res = []
	current = 1
	for i in range(N):
		res.append(current)
		current *= 10
		current %= MOD
	return res

def precompute_Mp(N, Ms):
	res = [0]
	for i in range(N):
		res.append((res[-1] + Ms[i] * (i + 1)) % MOD)
	return res
s = input()
s = s[::-1]
N = len(s)
Mc = precompute_Mc(N)
Ms = precompute_Ms(N)
Mp = precompute_Mp(N, Ms)
lastAr = 0
answer = 0
for i in range(N):
	c = int(s[i]) * Mc[N - i - 1] * Ms[i] % MOD
	d = int(s[i]) * Mp[i] % MOD
	answer += c
	answer += d
	answer %= MOD
print(answer)


import os
import sys
from io import BytesIO, IOBase
mod = 10 ** 9 + 7

def main():
	s = list(map(int, input()))
	pre = 1
	n = len(s)
	ans = n * (n - 1) // 2 * s[-1]
	p = 1
	for i in range(n - 2, -1, -1):
		p = p * 10 % mod
		if s[i]:
			z = i * (i + 1) // 2 % mod
			ans = (ans + z * p * s[i] + pre * s[i]) % mod
		pre = (pre + p * (n - i)) % mod
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = input()[::-1]
m = len(n)
count = 0
mod = 10 ** 9 + 7

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a, m):
	(g, x, y) = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m
zz = modinv(9 ** 2, mod)
zzz = modinv(9, mod)
for i in range(0, m):
	if n[i] == '0':
		continue
	p = int(n[i])
	ppp = pow(10, i, mod)
	count += p * ppp * ((m - i - 1) * (m - i) // 2)
	count = count % mod
	sumt = 0
	if i > 0:
		sumt = p * (((i - 1) * (ppp * 10) % mod - i * ppp + 10) * zz) % mod
		sumt += p * ((ppp - 1) * zzz) % mod
	count = (count + sumt) % mod
print(int(count))


s = input()
n = len(s)
dp = []
(cur, pw) = (0, 1)
mod = int(1000000000.0 + 7)
for i in range(1, n + 1):
	cur = (cur + i * pw) % mod
	pw = pw * 10 % mod
	dp.append(cur)
ans = 0
for (i, x) in enumerate(s):
	k = n - 2 - i
	if k >= 0:
		ans += dp[k] * int(x)
	ans += i * (i + 1) // 2 * int(x) * pow(10, n - i - 1, mod)
	ans %= mod
print(ans)


from sys import stdin
N = stdin.readline().strip()
ans = 0
mult = 0
length = len(N)
buffer = 1
times = length * (length - 1) // 2
k = 0
for i in range(length - 1, -1, -1):
	j = int(N[i])
	ans += j * mult
	ans += j * buffer * times
	times -= i
	mult += buffer * (k + 1)
	k += 1
	buffer %= 10 ** 9 + 7
	buffer *= 10
	k %= 10 ** 9 + 7
	mult %= 10 ** 9 + 7
print(ans % (10 ** 9 + 7))


s = input()[::-1]
M = 10 ** 9 + 7
r = 0
n = len(s)
cumu = 0
d10 = 1
for d in range(n):
	x = int(s[d])
	g = n - 1 - d
	ds = d10 * x * (g * (g + 1)) // 2
	ds += cumu * x
	r += ds
	cumu += (d + 1) * d10
	d10 = d10 * 10
	d10 = d10 % M
	cumu = cumu % M
	r = r % M
print(r % M)


n = input()
m = len(n)
M = int(1000000000.0) + 7
s = 0
ans = 0
for (i, c) in enumerate(n):
	x = int(c)
	a = s * (m - i) % M
	b = x * (i * (i + 1) // 2 % M) % M
	ans = (ans + pow(10, m - i - 1, M) * (a + b)) % M
	s = (s + x) % M
print(ans)


from math import ceil
from collections import defaultdict

def solve():
	s = input()
	n = len(s)
	place = 0
	dp = [0] * (n + 1)
	dp[1] = 0
	sum = int(s[0])
	mod = 10 ** 9 + 7
	ha = sum
	for i in range(2, n + 1):
		z = int(s[i - 1])
		dp[i] = dp[i - 1] * 10 + (i - 1) * i * z // 2 + ha
		dp[i] %= mod
		sum = sum * 10 + z
		sum %= mod
		ha += sum
		ha %= mod
	print(dp[n] % mod)
solve()


import sys
from itertools import accumulate, chain
MOD = 10 ** 9 + 7

def main():
	s = sys.stdin.readline().strip()
	digits = len(s)
	total = 0
	ten_to_i = list(accumulate(range(0, 10 ** 5 + 1), lambda prev, _: prev * 10 % MOD, initial=1))
	lookup = chain([1], ten_to_i)
	lookup = map(lambda p: p[0] * p[1] % MOD, enumerate(lookup))
	lookup = list(accumulate(lookup))
	for (i, c) in enumerate(reversed(s)):
		d = int(c)
		total += d * lookup[i]
		total %= MOD
		left = digits - (i + 1)
		total += d * ten_to_i[i] * left * (left + 1) // 2
		total %= MOD
	print(total)
main()


n = list(input())
s = 0
n = n[::-1]
t = len(n)
sum = 0
s = 1
p = 0
b = 0
for i in range(t):
	a = int(n[i])
	if a != 0:
		if i == 1:
			p = 1
		sum = (sum + a * s * (t - i - 1) * (t - i) // 2 + a * (b + i * p)) % 1000000007
		b = (b + i * p) % 1000000007
		p = p * 10 % 1000000007
		s = s * 10 % 1000000007
	else:
		if i == 1:
			p = 1
		b = (b + i * p) % 1000000007
		p = p * 10 % 1000000007
		s = s * 10 % 1000000007
print(sum)


s = input()
MOD = 10 ** 9 + 7
j = len(s)
dp = []
for i in range(j + 1):
	dp.append([])
	for k in range(3):
		dp[-1].append(0)
for i in range(j):
	dp[i + 1][0] = (dp[i][0] * 10 + int(s[i])) % MOD
	dp[i + 1][1] = (dp[i][0] + dp[i][1]) % MOD
	dp[i + 1][2] = (dp[i][2] * 10 + i * (i + 1) // 2 * int(s[i]) + 10 * dp[i][1]) % MOD
print((dp[j][2] + dp[j][1]) % MOD)


mod = 10 ** 9 + 7
n = str(input())
length = len(n)
ans = 0
dp = [0] * length

def func():
	for j in range(0, length):
		res = pow(10, j, mod) * (j + 1) % mod
		dp[j] = res
	for i in range(1, length):
		dp[i] = (dp[i - 1] + dp[i]) % mod
func()
for i in range(length):
	if n[i] != '0':
		nop = max(0, i)
		nos = length - 1 - i
		ans += int(n[i]) * (nop * (nop + 1) // 2) * pow(10, nos, mod) % mod
		if nos != 0:
			ans += dp[nos - 1] * int(n[i]) % mod
print(ans % mod)


M = 10 ** 9 + 7
arr = input()
n = len(arr)
tens = [1] * (n + 1)
for i in range(1, n + 1):
	tens[i] = tens[i - 1] * 10 % M
dp = [0] * n
for i in range(n - 2, -1, -1):
	dp[i] = (n - i - 1) * tens[n - i - 2] + dp[i + 1]
ans = 0
for i in range(n):
	dp[i] += (i * i + i) // 2 * tens[n - i - 1] % M
	ans += int(arr[i]) * dp[i]
	ans %= M
print(ans)


MOD = 10 ** 9 + 7
s = input().strip()
n = len(s)
X = [0] * (n + 1)
Y = [0] * (n + 1)
for i in range(1, n + 1):
	X[i] = (X[i - 1] * 10 + int(s[i - 1])) % MOD
	Y[i] = Y[i - 1] + X[i]
R = 0
t = 1
tt = 0
for i in range(n, 0, -1):
	R = (R + Y[i - 1] * t + tt * i) % MOD
	tt = (tt + int(s[i - 1]) * t) % MOD
	t = t * 10 % MOD
print(R)


import sys
input = sys.stdin.readline
MOD = 10 ** 9 + 7
N = 10 ** 5 + 100
fact = [0 for _ in range(N)]
invfact = [0 for _ in range(N)]
fact[0] = 1
for i in range(1, N):
	fact[i] = fact[i - 1] * i % MOD
invfact[N - 1] = pow(fact[N - 1], MOD - 2, MOD)
for i in range(N - 2, -1, -1):
	invfact[i] = invfact[i + 1] * (i + 1) % MOD

def nCk(n, k):
	if k < 0 or n < k:
		return 0
	else:
		return fact[n] * invfact[k] * invfact[n - k] % MOD

def main():
	n = input().strip()
	ans = 0
	l = len(n)
	plus = 0
	plus2 = 1
	plus3 = 1
	for (i, str_num) in enumerate(n[::-1]):
		num = int(str_num)
		j = l - i - 1
		ans += nCk(j + 1, 2) * pow(10, i, MOD) * num
		ans %= MOD
		ans += num * plus
		ans %= MOD
		plus += plus2 * plus3
		plus2 *= 10
		plus3 += 1
		plus %= MOD
		plus2 %= MOD
		plus3 %= MOD
	print(ans)
main()


import sys
import math as m
MOD = int(1000000000.0 + 7)
n = input()
l = len(n)
f = [0] * 1000001
f[0] = 0
f[1] = 1
pos = 10
for i in range(2, l):
	f[i] = (f[i - 1] + i * pos % MOD) % MOD
	pos = pos * 10 % MOD
ans_ = int(0)
pos_ = 1
for i in range(l - 1, -1, -1):
	if i == 0:
		tmp1 = 0
	else:
		tmp1 = i * (i + 1) // 2 % MOD * int(n[i]) % MOD % MOD * pos_ % MOD
	tmp2 = int(n[i]) * f[l - 1 - i] % MOD
	ans_ = ((ans_ + tmp1) % MOD + tmp2) % MOD
	pos_ = pos_ * 10 % MOD
print(ans_)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]
from collections import defaultdict

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24

def solve():
	s = inp()
	n = len(s)
	ar = [0]
	for i in s:
		ar.append((ar[-1] * 10 + int(i)) % mod)
	c = 0
	neg = 0
	for i in range(n, -1, -1):
		neg += c * ar[i]
		neg %= mod
		c = (10 * c + 1) % mod
	c = 1
	pos = 0
	for i in range(n, -1, -1):
		pos += c * i * ar[i]
		pos %= mod
		c = 10 * c % mod
	dif = ((pos - neg) % mod + mod) % mod
	t = n * (n + 1) // 2
	t %= mod
	t *= ar[-1]
	t %= mod
	print(((t - dif) % mod + mod) % mod)
solve()


mod = 10 ** 9 + 7
s = input()[::-1]
n = len(s)
suff = 0
prev = 0
a = [0] * (n + 1)
total = 0
for i in range(n):
	total = (total + int(s[n - i - 1]) * pow(10, n - i - 1, mod)) % mod
	prev = (int(s[i]) * pow(10, i, mod) + prev) % mod
	suff = (suff + prev) % mod
	a[i + 1] = (a[i] * 10 + 10) % mod
s = s[::-1]
pref = 0
ans = 0
for i in range(n):
	suff -= total
	suff += mod
	suff %= mod
	ans += pref * (a[n - i - 1] + 1) + suff
	ans %= mod
	pref = (pref * 10 + int(s[i])) % mod
	total -= int(s[i]) * pow(10, n - i - 1, mod)
	total += mod
	total %= mod
print(ans)


def inv(x):
	return pow(x, 1000000005, 1000000007)
s = input()
ans = 0
n = len(s)
for i in range(n - 1, -1, -1):
	z = pow(10, n - 1 - i, 1000000007) * int(s[i])
	z = z * (i * (i + 1)) // 2
	ans += z
	ans %= 1000000007
	k = n - 1 - i
	op = 0
	op += pow(10, k, 1000000007) * (9 * k - 1)
	op %= 1000000007
	op += 1
	op = op * inv(81)
	op %= 1000000007
	op = op * int(s[i])
	ans += op
	ans %= 1000000007
print(ans)


import os
import sys
import io
import functools
import copy
import math
GANS = []

def cmp(x, y):
	if x[1] == y[1]:
		return -(y[0] - x[0])
	return -(x[1] - y[1])
t = input()
m = int(1000000000.0 + 7)
d = [1]
for i in range(100010):
	d.append(d[-1] * 10 % m)

def prefsum(e, s=1):
	return int((e - s + 1) * (e + s) // 2)
pref = []
cur = []
ans = 0
su = 0

def mi10(po):
	return d[po]
for (p, i) in enumerate(t):
	su += int(i)
	su %= m
	pref.append(su)
for (p, i) in enumerate(t[::-1]):
	cur = 0
	if p:
		cur += pref[-p - 1] * p % m * mi10(p - 1) % m
		cur %= m
	cur += int(i) * int(prefsum(len(t) - p - 1)) % m * mi10(p) % m
	ans = (ans + cur) % m
print(ans)


mod = int(1000000000.0 + 7)
s = input()
n = len(s)
pref = [0] * (n + 1)
for i in range(n):
	pref[i + 1] = (int(s[i]) + pref[i] * 10) % mod
for i in range(n):
	pref[i + 1] = (pref[i + 1] + pref[i]) % mod
res = 0
acc = 0
for i in range(n, 0, -1):
	res += pref[i - 1] * pow(10, n - i, mod) + i * acc
	res %= mod
	acc = acc + int(s[i - 1]) * pow(10, n - i, mod) % mod
print(res)


from sys import stdin, stdout
input = stdin.readline
print = lambda x: stdout.write(str(x) + '\n')
N = input().strip()
l = len(N)
mod = 10 ** 9 + 7
pow10 = [1]
for i in range(1, l + 1):
	pow10.append(pow10[-1] * 10 % mod)
cache = [0]
for i in range(l - 1):
	cache.append((cache[-1] + (i + 1) * pow10[i]) % mod)
cache = cache[::-1]
for (i, ele) in enumerate(N):
	if 0 < i < l - 1:
		ans += (int(ele) * cache[i] + int(ele) * pow10[l - i - 1] * (1 + i) * i // 2) % mod
		ans %= mod
	elif i == 0:
		ans = int(N[0]) * cache[0] % mod
	else:
		ans += int(ele) * pow10[l - i - 1] * (1 + i) * i // 2 % mod
		ans %= mod
print(ans)


def modInverse(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
s = input()
p = 10 ** 9 + 7
req = 111111112
n = len(s)
j = n - 1
ans = 0
curr = 0
s1 = 0
while j >= 0:
	s1 = (curr + int(s[j]) * power(10, n - 1 - j, p)) % p
	curr = s1
	res = curr * j
	ans = (ans + res) % p
	j += -1
s1 = 0
curr = 0
j = 0
while j < n:
	s1 = (curr * 10 + int(s[j])) % p
	curr = s1
	res = curr * ((power(10, n - 1 - j, p) - 1) * req) % p
	ans = (ans + res) % p
	j += 1
print(ans % p)


p = 10 ** 9 + 7

def process(A):
	curr1 = [0, 0]
	curr2 = [0, 0]
	curr3 = [0, 1]
	for x in A:
		(a, b) = curr1
		(c, d) = curr2
		(e, f) = curr3
		(curr1, curr2) = ([a + e, b + f], [10 * a + 10 * c + int(x) * (b + d), b + d])
		curr1[0] = curr1[0] % p
		curr2[0] = curr2[0] % p
		curr3 = [10 * e + int(x), 1]
		curr3[0] = curr3[0] % p
	return (curr1[0] + curr2[0]) % p
n = input()
print(process(n))


mod = 10 ** 9 + 7
s = [int(d) for d in input()]
dp = [0 for j in range(10 ** 5 + 10)]
ss = [0 for j in range(10 ** 5 + 10)]
ss[0] = s[0]
curr = s[0]
for i in range(1, len(s)):
	digit = s[i]
	dp[i] = (dp[i - 1] * 10 + int(s[i] * i * (i + 1) / 2) + ss[i - 1]) % mod
	curr = (curr * 10 + s[i]) % mod
	ss[i] = (ss[i - 1] + curr) % mod
print(dp[len(s) - 1])


import itertools
import math
import sys
from collections import defaultdict

def stdinWrapper():
	data = '107\n\n'
	for line in data.split('\n'):
		yield line
if '--debug' not in sys.argv:

	def stdinWrapper():
		while True:
			yield sys.stdin.readline()
inputs = stdinWrapper()

def inputWrapper():
	return next(inputs)

def getType(_type):
	return _type(inputWrapper())

def getArray(_type):
	return [_type(x) for x in inputWrapper().split()]

def tuplerize(method):

	def wrap(*args, **kwargs):
		res = method(*args, **kwargs)
		if not isinstance(res, (tuple, list)):
			res = (res,)
		return res
	return wrap

@tuplerize
def solve(n):
	mod = 10 ** 9 + 7
	dp = [[0, (0, 0), (0, 0)] for _ in range(len(n))]
	dp[0][0] = int(n[0])
	dp[0][1] = (1, 0)
	for i in range(1, len(n)):
		d = int(n[i])
		dp[i][0] = (dp[i - 1][0] * 10 % mod + d) % mod
		dp[i][1] = (1 + dp[i - 1][1][0], (dp[i - 1][0] + dp[i - 1][1][1]) % mod)
		dp[i][2] = (dp[i - 1][1][0] + dp[i - 1][2][0], ((dp[i - 1][1][1] * 10 % mod + dp[i - 1][1][0] * d % mod) % mod + (dp[i - 1][2][1] * 10 % mod + dp[i - 1][2][0] * d % mod) % mod) % mod)
	return (dp[-1][2][1] + dp[-1][1][1]) % mod
n = input()
res = solve(n)
print(*res)


m = 1000000007
ans = 0
str = input()
n = len(str)
dp = [0] * (n + 1)
ten = [1] * (n + 1)
for i in range(1, n + 1):
	ten[i] = ten[i - 1] * 10 % m
	dp[i] = (dp[i - 1] + i * ten[i - 1]) % m
for i in range(n):
	ans = ans + (dp[n - i - 1] + (i * i + i) // 2 * ten[n - i - 1]) * int(str[i])
	ans = ans % m
print(ans)


mod = 10 ** 9 + 7
n = input()
L = len(n)
sm = 0
pre = 0
temp = 0
i = 0
while i < L:
	x = int(n[i])
	sm = sm * 10 % mod
	if temp & 1:
		freq = temp + 1 >> 1
		freq = freq * temp % mod
	else:
		freq = temp >> 1
		freq = freq * (temp + 1) % mod
	sm = (sm + freq * x % mod) % mod
	sm = (sm + pre * (L - temp) % mod) % mod
	pre = (pre + x) % mod
	temp += 1
	i += 1
print(sm)


MODN = int(1000000000.0 + 7)
s = input()
n = len(s)
prefix = []
sum = 0
for i in s:
	sum += ord(i) - ord('0')
	sum %= MODN
	prefix.append(sum)
ans = 0
for i in range(n - 1):
	ans += pow(10, i, MODN) * (i + 1) * prefix[n - 1 - i - 1]
	ans %= MODN
for i in range(1, n + 1):
	lf = i - 1
	a = ord(s[i - 1]) - ord('0')
	ans += (1 + lf) * lf // 2 % MODN * a * pow(10, n - i, MODN)
	ans %= MODN
print(ans)


mod = 10 ** 9 + 7
bb = 1
while bb:
	s = input()
	n = len(s)
	n = len(s)
	c = 0
	ans = 0
	d = 0
	e = 1
	for i in range(n - 1, 0, -1):
		c = (int(s[i]) * e + c) % mod
		d = (d + c) % mod
		e = e * 10 % mod
		ans = (ans + d) % mod
	c = 0
	m = 0
	e = 1
	while c <= n - 2:
		m = (m + e) % mod
		e = e * 10 % mod
		c += 1
	c = 0
	k = n - 2
	for i in range(n - 1):
		c = (c * 10 + int(s[i])) % mod
		ans = (ans + c * m) % mod
		m = (m - pow(10, k, mod)) % mod
		k -= 1
	print(ans)
	bb -= 1


from sys import stdin
input = stdin.readline
mod = 10 ** 9 + 7
s = input()
n = len(s) - 1
inv = pow(2, mod - 2, mod)
inv9 = pow(9, mod - 2, mod)
dp = [0] * n
ans = n * (n - 1) * inv * int(s[n - 1]) % mod
for i in range(n - 2, -1, -1):
	dp[i] = (dp[i + 1] * 10 + (pow(10, n - i - 1, mod) - 1) * inv9) % mod
	ans = (ans + int(s[i]) * (pow(10, n - i - 1, mod) * i * (i + 1) * inv + dp[i])) % mod
print(ans)


s = input()
ans = 0
mod = 10 ** 9 + 7
n = len(s)
ps = [0]
cp = 1
for i in range(n - 1, -1, -1):
	ps.append((ps[-1] + int(s[i]) * cp) % mod)
	cp = cp * 10 % mod
ps.reverse()
prefs = 0
lastpref = 0
for i in range(n):
	nextdigs = ps[i + 1]
	ans = (ans + prefs * pow(10, n - i - 1, mod) % mod + nextdigs * (i + 1)) % mod
	lastpref = (lastpref * 10 + int(s[i])) % mod
	prefs = (prefs + lastpref) % mod
print(ans)


import sys
import math, bisect
sys.setrecursionlimit(10 ** 5)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict

def I():
	return int(sys.stdin.readline())

def neo():
	return map(int, sys.stdin.readline().split())

def Neo():
	return list(map(int, sys.stdin.readline().split()))
num = input()
n = len(num)
ans = 0
mod = 1000000007
tis = [0] * n
sim = int(num[0])
ans = 0
for i in range(1, n):
	tis[i] = (n - i) * sim + i * (i + 1) // 2 * int(num[i])
	sim = sim + int(num[i])
ten = [1]
for _ in range(n):
	ten.append(ten[-1] * 10 % mod)
for i in range(n):
	ans = (ans + tis[n - 1 - i] * ten[i]) % mod
print(ans)


s = input()
ln = len(s)
res = 0
MOD = 10 ** 9 + 7
left_del = [0] * ln
right_del = [0] * ln
lmul = rmul = 1
for i in range(ln - 1, -1, -1):
	if i < ln - 1:
		right_del[i] = rmul * (ln - 1 - i) % MOD + right_del[i + 1]
		rmul = rmul * 10 % MOD
		right_del[i] = right_del[i] % MOD
	left_del[i] = lmul
	lmul = lmul * 10 % MOD
for i in range(ln):
	v = int(s[i])
	res += v % MOD * (i * (i + 1) // 2) % MOD * left_del[i] % MOD
	res += v * right_del[i] % MOD
	res = res % MOD
print(res)


import sys

def redirect():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
inp = input()[::-1]
mod = 10 ** 9 + 7
n = len(inp)
b_1 = 0
dp_1 = 0
b = b_1
dp = dp_1
tenth = 1
for i in range(0, n):
	x = (n - i - 1) * (n - i) // 2 * int(inp[i]) * tenth
	y = b_1 * int(inp[i])
	dp = dp_1 + x + y
	b = b_1 + (i + 1) * tenth
	dp %= mod
	b %= mod
	b_1 = b
	dp_1 = dp
	tenth = tenth * 10 % mod
print(dp)


import os, sys
from io import BytesIO, IOBase

def main():
	mod = 10 ** 9 + 7
	power = [1]
	for _ in range(10 ** 5 + 1):
		power.append(power[-1] * 10 % mod)
	n = input().strip()
	ans = 0
	y = 0
	x = len(n) - 1
	qq = pow(9, mod - 2, mod)
	qq1 = pow(81, mod - 2, mod)
	for i in range(len(n) - 1):
		rr = (x * power[x] - 1) * qq % mod
		rr1 = 10 * (power[x - 1] - 1) * qq1 % mod
		rr2 = y * (y + 1) // 2 * power[x] % mod
		ans += (rr - rr1 + rr2) * int(n[i]) % mod
		ans %= mod
		x -= 1
		y += 1
	ans += y * (y + 1) // 2 * int(n[-1]) % mod
	print(ans % mod)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


mod = 1000000007
s = input()
n = len(s)
(su, ans, c, x) = (0, [], 0, 0)
for i in s:
	su += int(i)
for i in range(1, n):
	su -= int(s[-i])
	ss = su * i + int(s[-i]) * ((n - i) * (n - i + 1)) // 2 + c
	if i == n - 1:
		x = ss
	else:
		ans.append(ss % 10)
	c = ss // 10
ans.reverse()
pp = str(x) + ''.join(map(str, ans))
print(int(pp) % mod)


a = list(map(int, list(input())))
n = len(a)
c = 0
d = 10 ** 9 + 7
for i in range(n - 1):
	k = n - i - 1
	p = a[i] * (k * pow(10, k + 1, d) - (k + 1) * pow(10, k, d) + 1)
	p = p * pow(81, d - 2, d)
	c += p % d
e = 0
for i in range(n - 1, 0, -1):
	e += a[i] * pow(10, n - i - 1, d)
	c += i * e % d
print(c % d)


MODULUS = 10 ** 9 + 7

def solve(n):
	l = len(n)
	if l < 2:
		return 0
	result = int(n[0]) + int(n[1])
	if l == 2:
		return result
	x = 0
	y = int(n[0])
	z = int(n[0])
	for i in range(2, l):
		x += i
		result = (result * 10 % MODULUS + int(n[i]) * x % MODULUS) % MODULUS
		result = (result + int(n[i]) % MODULUS) % MODULUS
		y = (y * 10 % MODULUS + int(n[i - 1]) % MODULUS) % MODULUS
		z = (z + y % MODULUS) % MODULUS
		result = (result + z) % MODULUS
	return result
n = input()
print(solve(n))


n = input().strip()
M = 1000000007
l = len(n)
a = 0
b = 0
for (i, c) in enumerate(n[::-1]):
	c = int(c)
	p = l - 1 - i
	a += p * (p + 1) // 2 * c * pow(10, i, M)
	a += b * c
	a %= M
	b += (i + 1) * pow(10, i, M)
	b %= M
print(a)


import sys
import math
from collections import defaultdict, Counter
mod = pow(10, 9) + 7
n = list(map(int, list(input())))
n1 = len(n)
ans = 0
pre = 0
for i in range(n1 - 1, -1, -1):
	c = i * (i + 1) // 2
	p = pow(10, n1 - i - 1, mod)
	c1 = n[i] * pre % mod
	cur = c * p * n[i] % mod
	cur1 = pre * n[i] % mod
	ans = (ans + cur + cur1) % mod
	pre = ((n1 - i) * p + pre) % mod
print(ans)


from sys import stdin
input = stdin.readline

def A():
	t = int(input())
	for _ in range(t):
		l = list(map(int, input().split()))
		l.sort()
		x = l[2] - l[1] - l[0]
		x = max(x, 0) + 1
		print(x)

def B():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, input().split())
		mat = [[] for i in range(n)]
		newMat = [[0 for j in range(m)] for i in range(n)]
		for i in range(n):
			a = list(map(int, input().split()))
			mat[i] = a
		tot = 0
		for i in range(n // 2):
			for j in range(m // 2):
				s = sorted([mat[i][j], mat[i][m - j - 1], mat[n - i - 1][j], mat[n - i - 1][m - j - 1]])
				dest = round(newMat[i][j] / 4)
				dest = max(dest, s[1])
				dest = min(dest, s[2])
				for k in s:
					tot += abs(k - dest)
		if n % 2 == 1:
			for j in range(m // 2):
				dest = (mat[n // 2][j] + mat[n // 2][m - j - 1]) // 2
				tot += abs(mat[n // 2][j] - dest)
				tot += abs(mat[n // 2][m - j - 1] - dest)
		if m % 2 == 1:
			for i in range(n // 2):
				dest = (mat[i][m // 2] + mat[n - i - 1][m // 2]) // 2
				tot += abs(mat[i][m // 2] - dest)
				tot += abs(mat[n - i - 1][m // 2] - dest)
		print(tot)

def C():
	a = list(map(int, input().rstrip()))
	n = len(a)
	mod = 10 ** 9 + 7
	dp = [0] * n
	dp[0] = 0
	for i in range(1, n):
		dp[i] = (dp[i - 1] + i * pow(10, i - 1, mod)) % mod
	tot = 0
	for i in range(0, n):
		if i == n - 1:
			left = 0
		else:
			left = (n - i - 1) * (n - i) // 2 % mod
			left = left * a[n - i - 1] * pow(10, i, mod) % mod
		right = a[n - i - 1] * dp[i] % mod
		tot = (tot + left + right) % mod
	print(tot)
C()


MOD = 10 ** 9 + 7
sn = list(map(int, list(input())))
N = len(sn)
tm = [1]
am = [0]
s = 1
psn = [0]
for i in range(N - 1):
	tm.append(tm[-1] * 10 % MOD)
	psn.append(psn[-1] + sn[i])
	am.append((am[-1] + s) % MOD)
	s += 1
res = 0
for i in range(1, N):
	res += sn[i] * am[i] * tm[N - i - 1]
	res += tm[i - 1] * i * psn[-i]
res %= MOD
print(res)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from heapq import *
from math import gcd, factorial, floor, ceil
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 10 ** 9 + 7

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	s = list(inp())
	n = len(s)
	for i in range(n):
		s[i] = int(s[i])
	ans = [0] * n
	for i in range(n):
		ans[i] += i * (i + 1) // 2 * power(10, n - i - 1, mod) % mod
	new = [0] * n
	for i in range(n - 1):
		new[i] = (i + 1) * power(10, i, mod)
		new[i] %= mod
	pre = [0] * (n + 1)
	for i in range(n):
		pre[i] = pre[i - 1] + s[i]
	for i in range(n - 1):
		new[i] *= pre[n - i - 2]
		new[i] %= mod
	for i in range(n):
		ans[i] *= s[i]
		ans[i] %= mod
	for i in range(n):
		ans[i] += new[i]
		ans[i] %= mod
	print(sum(ans) % mod)
testcase(1)


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')
file = 1

def solve():
	m = si()
	n = len(m)
	presum = [0] * n
	power = [1] * (n + 1)
	for i in range(n):
		presum[i] = (i + 1) * power[i]
		presum[i] %= mod
		if i > 0:
			presum[i] += presum[i - 1]
			presum[i] %= mod
		power[i + 1] = power[i]
		power[i + 1] *= 10
		power[i + 1] %= mod
	ans = 0
	for i in range(n):
		l = i * (i + 1) // 2
		l *= power[n - i - 1]
		l %= mod
		if i < n - 1:
			r = presum[n - i - 2]
			l += r
			l %= mod
		l *= int(m[i])
		l %= mod
		ans += l
		ans %= mod
	print(ans)
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output1.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


n = input()
mod = 10 ** 9 + 7
ans = 0
summ = 0
num = int(n[-1])
a = num
j = 0
paw = [1]
for i in range(len(n) + 1):
	paw.append(paw[-1] * 10 % mod)
for i in range(len(n) - 2, -1, -1):
	summ = (summ + (j + 1) * paw[j] % mod) % mod
	ans = ((a + ans) % mod + int(n[i]) * summ % mod) % mod
	j += 1
	num += paw[j] * int(n[i]) % mod
	a += num
print(ans)


string = input().strip(' ')[::-1]
answer = 0
MOD = int(1000000000.0 + 7)
right_combs = 0
l = len(string)
for i in range(l):
	digit = int(string[i])
	num_left_elements = l - i - 1
	answer += num_left_elements * (num_left_elements + 1) // 2 * digit * pow(10, i, MOD)
	answer += right_combs * digit
	answer %= MOD
	right_combs += (i + 1) * pow(10, i, MOD)
	right_combs %= MOD
else:
	print(answer)


from sys import stdin
input = stdin.readline
MOD = 10 ** 9 + 7

def solve():
	n = input().strip()
	res = 0
	length = len(n)
	m10 = [1] * length
	for i in range(1, length):
		m10[i] = m10[i - 1] * 10 % MOD
	inv2 = pow(2, MOD - 2, MOD)
	inv81 = pow(81, MOD - 2, MOD)
	for (i, v) in enumerate(n):
		if v == '0':
			continue
		v = int(v)
		l = i
		r = length - i - 1
		base = v * m10[r] % MOD
		res += base * l * (l + 1) * inv2 % MOD
		base2 = v * ((9 * r - 1) * m10[r] + 1) * inv81 % MOD
		res += base2
		res %= MOD
	print(res)
solve()


import sys
input = sys.stdin.readline
from collections import defaultdict as dd
n = list(map(int, input().strip()))
pre = []
mod = 10 ** 9 + 7
nn = len(n)
pre = [n[0]]
po = 1
tpo = [1]
for i in range(1, 100000 + 5):
	tpo.append(tpo[-1] * 10 % mod)
for i in range(1, 100000 + 5):
	tpo[i] = (tpo[i] + tpo[i - 1]) % mod
for i in range(1, nn):
	pre.append((10 * pre[i - 1] + n[i]) % mod)
pre = [0] + pre
pos = [0] * nn
pos[-1] = n[-1]
po = 1
for i in range(nn - 2, -1, -1):
	po = po * 10 % mod
	pos[i] = (po * n[i] + pos[i + 1]) % mod
pos = pos + [0]
for i in range(nn - 1, -1, -1):
	pos[i] = pos[i] + pos[i + 1]
ans = 0
for i in range(1, nn):
	po = tpo[nn - i - 1]
	su = pos[i]
	ans = (ans + pre[i] * po + su) % mod
print(ans)


import sys
input = sys.stdin.readline

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)
mod = 10 ** 9 + 7

def main():
	s = input()
	a = []
	n = len(s) - 1
	k = 0
	for i in range(n - 1, -1, -1):
		a.append(s[i])
		k += int(s[i])
	pow10 = []
	c = 1
	for i in range(n + 1):
		pow10.append(c)
		c *= 10
		c %= mod
	ans = 0
	ind = 0
	for i in range(n):
		ans += pow10[i] * ((n - i - 1) * (n - i) // 2) % mod * int(a[i]) % mod
		ans %= mod
		ans += pow10[i - 1] * i % mod * k % mod
		ans %= mod
		k -= int(a[ind])
		ind += 1
	print(ans)
	return
main()


MOD = 10 ** 9 + 7
s = input()
(cnt1, cnt2, cnt3) = (1, 0, 0)
(ans1, ans2, ans3) = (0, 0, 0)
ans = 0
for i in s:
	i = int(i)
	(ans1, ans2, ans3) = ((ans1 * 10 + i) % MOD, (ans2 + ans1) % MOD, ((ans3 + ans2) * 10 % MOD + i * (cnt2 + cnt3) % MOD) % MOD)
	(cnt2, cnt3) = ((cnt2 + 1) % MOD, (cnt3 + cnt2) % MOD)
print((ans2 + ans3) % MOD)


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
m = 10 ** 9 + 7

def modExp(a, n, m=10 ** 9 + 7):
	if n == 0:
		return 1
	elif n == 1:
		return a
	else:
		while n >= 2:
			if n % 2 == 0:
				n = n // 2
				return modExp(a % m * (a % m) % m, n, m)
			else:
				n = (n - 1) // 2
				return a % m * modExp(a % m * (a % m) % m, n, m) % m % m
s = input()
n = len(s)
out = 0
c = 0
for i in range(n - 1, -1, -1):
	x = modExp(10, n - 1 - i) * int(s[i])
	out += x * (i * (i + 1) // 2 % m)
	if i < n - 1:
		c += (n - 1 - i) * modExp(10, n - i - 2)
		c %= m
	out += c * int(s[i])
	out %= m
print(out)


from sys import stdin, stdout
s = input()
n = len(s)
ans = 0
M = 10 ** 9 + 7
p10 = [1]
for i in range(n + 2):
	p10 += [p10[-1] * 10 % M]

def gp_sm(terms):
	num = p10[terms] - 1
	sm = num * pow(9, M - 2, M) % M
	return sm
for _ in range(1):
	pv = [0] * n
	pv_fb = [0] * n
	pos = 0
	for i in range(n - 1, -1, -1):
		pv[i] = p10[pos] * int(s[i]) % M
		if i != n - 1:
			pv[i] = (pv[i] + pv[i + 1]) % M
		pos += 1
	for i in range(n):
		if i == 0:
			pv_fb[i] = int(s[i])
		else:
			pv_fb[i] = (pv_fb[i - 1] * 10 + int(s[i])) % M
	for i in range(n - 2, -1, -1):
		pv[i] = (pv[i] + pv[i + 1]) % M
	for i in range(n):
		right_sm = left_sm = 0
		if i + 1 < n:
			right_sm = pv[i + 1]
		zeros = n - i - 1
		if i - 1 >= 0:
			left_sm = pv_fb[i - 1]
		new = left_sm * gp_sm(zeros + 1) % M
		ans = (ans + new + right_sm) % M
	print(ans)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil, pi, sin, cos, acos, atan
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = 1
for _ in range(t):
	s = ips()
	n = len(s)
	arr = []
	ans = 0
	dp = [0] * (n + 1)
	for i in range(1, n + 1):
		dp[i] = (dp[i - 1] + pow(10, i - 1, mod) * i % mod) % mod
	for i in range(n):
		before = i
		after = n - i - 1
		cur_pow = after
		value = int(s[i]) * pow(10, cur_pow, mod) % mod
		value2 = before * (before + 1) // 2 % mod
		ans = (ans + int(s[i]) * dp[after]) % mod
		ans = ans + value * value2 % mod
	ans = ans % mod
	out(ans)


MOD = 10 ** 9 + 7
digits = [int(x) for x in input()]
n = len(digits)
left = [0 for _ in range(n)]
right = [0 for _ in range(n)]
tot = 0
l = 0
for i in range(n):
	l = l * 10 % MOD
	l = (l + digits[i]) % MOD
	tot = (tot + l) % MOD
	left[i] = tot
r = 0
m = 1
for i in range(n - 1, -1, -1):
	r = (r + digits[i] * m % MOD) % MOD
	right[i] = r
	m = m * 10 % MOD
ans = 0
if n > 1:
	ans += right[1]
	ans %= MOD
for i in range(1, n - 1):
	leftCounts = i + 1
	ans += left[i - 1] * pow(10, n - i - 1, MOD) + leftCounts % MOD * right[i + 1] % MOD % MOD
	ans %= MOD
if n > 1:
	ans += left[n - 2]
ans %= MOD
print(ans)


MOD = 10 ** 9 + 7
digits = [int(x) for x in input()]
n = len(digits)
right = [0 for _ in range(n)]
r = 0
mul = 1
for i in range(n - 1, -1, -1):
	r += digits[i] * mul
	mul *= 10
	mul %= MOD
	r %= MOD
	right[i] = r
left = [0 for _ in range(n)]
l = 0
tot = 0
for i in range(n):
	l *= 10
	l += digits[i]
	l %= MOD
	tot += l
	tot %= MOD
	left[i] = tot
ans = 0
for rr in range(1, n + 1):
	leftIdx = rr - 2
	if leftIdx == -1 and rr == n:
		break
	if leftIdx == -1:
		ans += 1 * right[rr]
		ans %= MOD
	elif rr == n:
		nLeft = leftIdx + 2
		ans += left[leftIdx]
		ans %= MOD
	else:
		nLeft = leftIdx + 2
		ans += left[leftIdx] % MOD * pow(10, n - rr, MOD) + nLeft * right[rr] % MOD
		ans %= MOD
print(ans)


from __future__ import division, print_function
import bisect
import math
import heapq
import itertools
import sys
from collections import deque
from atexit import register
from collections import Counter
from functools import reduce
if sys.version_info[0] < 3:
	from io import BytesIO as stream
else:
	from io import StringIO as stream
if sys.version_info[0] < 3:

	class dict(dict):

		def items(self):
			return dict.iteritems(self)

		def keys(self):
			return dict.iterkeys(self)

		def values(self):
			return dict.itervalues(self)
	input = raw_input
	range = xrange
	filter = itertools.ifilter
	map = itertools.imap
	zip = itertools.izip

def sync_with_stdio(sync=True):
	global input, flush
	if sync:
		flush = sys.stdout.flush
	else:
		sys.stdin = stream(sys.stdin.read())
		input = lambda : sys.stdin.readline().rstrip('\r\n')
		sys.stdout = stream()
		register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))

def main():
	mod = 10 ** 9
	mod += 7
	s = input()
	n = len(s)
	peeche = [0] * n
	aage = [0] * n
	for i in range(1, n):
		peeche[i] = i * (i + 1) // 2
		peeche[i] *= pow(10, n - i - 1, mod)
		peeche[i] %= mod
	for i in range(n - 1):
		aage[0] += (i + 1) * pow(10, i, mod)
		aage[i] %= mod
	for i in range(1, n):
		aage[i] = aage[i - 1]
		aage[i] -= (n - i) * pow(10, n - i - 1, mod)
		aage[i] %= mod
	ans = 0
	for i in range(n):
		ans += int(s[i]) * (peeche[i] + aage[i])
		ans %= mod
	print(ans % mod)
sync_with_stdio(False)
main()


from sys import stdin
input = lambda : stdin.readline().strip()
lin = lambda : list(map(int, input().split()))
iin = lambda : int(input())
main = lambda : map(int, input().split())
from math import ceil, sqrt, factorial, log
from collections import deque
from bisect import bisect_left
mod = 998244353
mod = 1000000007

def gcd(a, b):
	(a, b) = (max(a, b), min(a, b))
	while a % b != 0:
		(a, b) = (b, a % b)
	return b

def moduloinverse(a):
	return pow(a, mod - 2, mod)

def solve(we):
	s = input()
	ans = 0
	su = 0
	decim = 1
	rep = 1
	last = len(s) - 1
	for i in range(len(s) - 1):
		su += int(s[i])
	for i in range(len(s) - 2, -1, -1):
		z = int(s[i + 1]) * (last * (last + 1) // 2) + rep * su
		ans = (ans + z * decim) % mod
		last -= 1
		rep += 1
		su -= int(s[i])
		decim = decim * 10 % mod
	print(ans % mod)
qwe = 1
for _ in range(qwe):
	solve(_ + 1)


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.buffer.readline())

def MI():
	return map(int, sys.stdin.buffer.readline().split())

def LI():
	return list(map(int, sys.stdin.buffer.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def BI():
	return sys.stdin.buffer.readline()[:-1]

def SI():
	return sys.stdin.buffer.readline()[:-1].decode()
md = 10 ** 9 + 7
mx = 10 ** 5 + 5
cc = [0]
ten = [1]
for _ in range(mx):
	ten.append(ten[-1] * 10 % md)
for i in range(mx):
	cc.append((cc[-1] + ten[i] * (i + 1)) % md)
s = input()
n = len(s)
ans = 0
for (i, a) in enumerate(s):
	a = int(a)
	ans += a * (cc[n - i - 1] + ten[n - i - 1] * i * (i + 1) // 2)
	ans %= md
print(ans)


import sys
input = sys.stdin.readline
from itertools import accumulate
S = input().strip()
mod = 10 ** 9 + 7
LEN = len(S)
ANS = [0] * (LEN + 1)
ANS2 = [0] * (LEN + 1)
ANS3 = [0] * (LEN + 1)
for i in range(LEN):
	x = int(S[LEN - 1 - i])
	k = LEN - i - 1
	p = k * (k + 1) // 2
	ANS[i] += x * p
	ANS2[0] += x
	ANS2[i] -= x
	ANS3[i] -= i * x
ANS2 = list(accumulate(ANS2))
for i in range(LEN + 1):
	ANS2[i] += ANS3[i]
ANS2 = list(accumulate(ANS2))
A = 0
for i in range(LEN):
	A += (ANS[i] + ANS2[i]) * pow(10, i, mod)
	A %= mod
print(A)


def main():
	mod = 10 ** 9 + 7
	s = input()
	n = len(s)
	dpl = [0] * (n + 1)
	dpr = [0] * (n + 1)
	pow10 = [1] * (n + 1)
	for i in range(1, n + 1):
		pow10[i] = 10 * pow10[i - 1] % mod
	for i in range(n):
		v = int(s[i])
		dpl[i + 1] = (10 * dpl[i] + v) % mod
	for i in range(n):
		v = int(s[-(i + 1)])
		dpr[i + 1] = (pow10[i] * v + dpr[i]) % mod
	ans = 0
	for i in range(n + 1):
		ans += (n - i) * dpr[i]
		ans %= mod
	s = 0
	for i in range(n):
		s += dpl[i]
		ans += pow10[n - 1 - i] * s
		ans %= mod
	print(ans % mod)
	return
main()


MOD = 10 ** 9 + 7
s = input()
ans = 0
nv = 0
sv = 0
for i in range(len(s)):
	d = ord(s[i]) - 48
	k = (i * (i + 1) // 2 + 1) % MOD
	ans = (ans * 10 + d * k + sv) % MOD
	nv = (nv * 10 + d) % MOD
	sv += nv
ans = (ans - nv) % MOD
if ans < 0:
	ans += MOD
print(ans)


mod = 1000000007
s = input()
ans = 0
for i in range(len(s)):
	ans += i * (i + 1) // 2 * (int(s[i]) * pow(10, len(s) - i - 1, mod))
	ans %= mod
current = 0
for i in range(len(s) - 1, 0, -1):
	current += int(s[len(s) - i - 1])
	ans += i * current * pow(10, i - 1, mod)
	ans %= mod
print(ans)


import sys
import random
from fractions import Fraction
from math import *

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def finput():
	return float(input())

def tinput():
	return input().split()

def linput():
	return list(input())

def rinput():
	return map(int, tinput())

def fiinput():
	return map(float, tinput())

def rlinput():
	return list(map(int, input().split()))

def trinput():
	return tuple(rinput())

def srlinput():
	return sorted(list(map(int, input().split())))

def NOYES(fl):
	if fl:
		print('NO')
	else:
		print('YES')

def YESNO(fl):
	if fl:
		print('YES')
	else:
		print('NO')

def main():
	s = input()
	n = len(s)
	mod = int(1000000000.0) + 7
	q = [0 for i in range(100100)]
	w = [0 for i in range(100100)]
	q[0] = 1
	w[0] = 1
	res = 1
	for i in range(1, 100100):
		res = res * 10 % mod
		q[i] = q[i - 1] + res
		q[i] %= mod
		w[i] = w[i - 1] * 10
		w[i] %= mod
	(l, res, r) = (0, 0, 0)
	for i in range(n - 1):
		l *= 10
		l += int(s[i])
		l %= mod
		res += l * q[n - 2 - i] % mod
		res %= mod
	for i in range(n - 1, 0, -1):
		r += w[n - 1 - i] * int(s[i])
		r %= mod
		res += r * i % mod
		res %= mod
	print(res)
for i in range(1):
	main()


mod = 10 ** 9 + 7

def main():
	num = input()
	n = len(num)
	s = 0
	c = 0
	k = 0
	for i in reversed(num):
		c += int(i) * pow(10, k, mod)
		c = c % mod
		s += (n - k - 1) * c
		s = s % mod
		k += 1
	c = 0
	k = n - 1
	for i in num:
		c = c * 10 + int(i)
		c = c % mod
		s += c * (pow(10, k, mod) - 1) * 111111112
		s = s % mod
		k -= 1
	print(s)
main()


MOD = 10 ** 9 + 7
N = input()
n = len(N)
powers = [1] * n
rhs = [0] * n
lhs = [0] * n
for i in range(1, n):
	powers[i] = powers[i - 1] * 10 % MOD
	rhs[i] = (rhs[i - 1] + powers[i - 1] * i) % MOD
	lhs[i] = i * (i + 1) // 2 % MOD
result = 0
for i in range(n):
	num = ord(N[i]) - ord('0')
	result = (result + num * (powers[n - 1 - i] * lhs[i] % MOD + rhs[n - 1 - i])) % MOD
print(result)


s = str(input())
a = len(s)
z = 10 ** 9 + 7
if a == 1:
	print(0)
else:
	lis = []
	power = [1]
	for i in range(1, a):
		if i != 1:
			power.append(power[-1] * 10 % z)
		lis.append(power[-1] * i % z)
	pref = [lis[0]]
	for i in range(1, a - 1):
		pref.append((pref[-1] + lis[i]) % z)
	ans = 0
	for i in range(a):
		back = i
		front = a - i - 1
		if i > 0:
			temp = back * (back + 1) // 2 * power[front]
			temp %= z
			temp *= int(s[i])
			temp %= z
			ans += temp
			ans %= z
		if i < a - 1:
			temp = pref[-i - 1]
			temp *= int(s[i])
			temp %= z
			ans += temp
			ans %= z
	print(ans)


s = list(map(int, input()))
ans = 0
mod = 10 ** 9 + 7
n = len(s)
s.reverse()
x = 0
power = [1]
for r in range(n):
	power.append(power[-1] * 10 % mod)
for (r, d) in enumerate(s):
	l = n - r - 1
	ans += l * (l + 1) // 2 % mod * (d * power[r] % mod) % mod
	ans %= mod
	ans += d * x % mod
	ans %= mod
	x += power[r] * ((r + 1) % mod) % mod
	ans %= mod
	x %= mod
print(ans % mod)


mod = 10 ** 9 + 7
de = [1]
for i in range(10 ** 5 + 10):
	de.append(de[-1] * 10 % mod)
de1 = [0, 1]
for i in range(1, 10 ** 5 + 10):
	de1.append(de1[-1] + de[i])
	de1[-1] %= mod
s = input()
n = len(s)
nw = 0
ans = 0
for i in range(n):
	nw = nw * 10 + ord(s[i]) - ord('0')
	nw %= mod
	ans += nw * de1[n - i - 1]
	ans %= mod
nw = 0
for i in range(n - 1, -1, -1):
	nw += de[n - 1 - i] * (ord(s[i]) - ord('0'))
	nw %= mod
	ans += nw * i
	ans %= mod
print(ans)


N = 100005
INF = 1000000007
pwr = [0] * N
sm = [0] * N
pwr[0] = 1
for i in range(1, N):
	pwr[i] = pwr[i - 1] * 10 % INF
s = input('')
n = len(s)
for i in range(n - 1, -1, -1):
	sm[i] = int(s[i])
	sm[i] = (sm[i + 1] + sm[i] * pwr[n - i - 1]) % INF
for i in range(n - 1, -1, -1):
	sm[i] += sm[i + 1]
	if sm[i] >= INF:
		sm[i] -= INF
for i in range(1, N - 1):
	pwr[i] += pwr[i - 1]
	if pwr[i] >= INF:
		pwr[i] -= INF
ans = 0
tmp = 0
for i in range(n):
	ans = (ans + tmp * pwr[n - i - 1] + sm[i + 1]) % INF
	tmp = (tmp * 10 + int(s[i])) % INF
print(ans)


a = input()
n = len(a)
mod = 1000000000 + 7
tmod = [0 for i in range(n)]
tmod[0] = 1
for i in range(1, n):
	tmod[i] = tmod[i - 1] * 10 % mod
st = [0 for i in range(max(n, 2))]
st[1] = 1
for i in range(2, n):
	st[i] = (st[i - 1] + tmod[i - 1]) % mod
cu = [0 for i in range(max(n, 3))]
cu[2] = 1
for i in range(3, n):
	cu[i] = (cu[i - 1] * 10 % mod + i - 1) % mod
ans = 0
for k in range(n):
	d = int(a[n - 1 - k])
	s = 0
	s += k * st[k] % mod
	s -= cu[k]
	s %= mod
	s += (n - 1 - k) * (n - k) // 2 % mod * tmod[k]
	s %= mod
	ans += s * d % mod
	ans %= mod
print(ans)


def discount(num):
	mo = 10 ** 9 + 7
	v = 0
	s = str(num)
	(v1, s1) = (0, 0)
	(v2, s2) = (0, 0)
	for i in range(len(s)):
		c = int(s[i])
		v2 = (10 * v2 + 10 * v1 + (s2 + s1) * c) % mo
		s2 = s2 + s1
		v1 = (v1 + v) % mo
		s1 = s1 + 1
		v = (v * 10 + c) % mo
	return (v1 + v2) % mo
print(discount(int(input())))


import time, math as mt, bisect as bs, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * (2 * 10 ** 5 + 5)
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(2 * 10 ** 5 + 5):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return

def readTree(n, e):
	adj = [set() for i in range(n + 1)]
	for i in range(e):
		(u1, u2) = IP()
		adj[u1].add(u2)
	return adj
mod = 10 ** 9 + 7

def solve():
	n = input()
	ll = len(n)
	mod10 = [1] * (10 ** 5 + 20)
	mod10[1] = 10
	for i in range(2, len(mod10)):
		mod10[i] = mod10[i - 1] * 10 % mod
	pref_mod10 = [0] * (10 ** 5 + 20)
	pref_mod10[1] = mod10[1]
	for i in range(2, len(mod10)):
		pref_mod10[i] = (pref_mod10[i - 1] % mod + mod10[i] % mod) % mod
	our = [1] * (ll + 1)
	our[1] = int(n[0])
	cur = 1
	for i in range(2, ll + 1):
		our[i] = (our[i - 1] * 10 + int(n[cur])) % mod
		cur += 1
	our_rev = [1] * (ll + 1)
	our_rev[ll] = int(n[-1])
	cur = ll - 2
	last = 10
	for i in range(ll - 1, 0, -1):
		our_rev[i] = (int(n[cur]) * last + our_rev[i + 1]) % mod
		cur -= 1
		last = last * 10 % mod
	pref = [0] * (ll + 1)
	pref[1] = our_rev[1]
	for i in range(2, ll + 1):
		pref[i] = (pref[i - 1] + our_rev[i]) % mod
	ans = 0
	for i in range(1, ll):
		sm = (pref[ll] - pref[i + 1] + mod) % mod
		lenl = ll - (i + 1)
		gt = pref_mod10[lenl]
		p1 = our[i] % mod * gt % mod % mod
		ans += (p1 + sm) % mod
	ans += (pref[ll] - pref[1] + mod) % mod % mod
	for i in range(1, ll):
		ans = (ans + our[i]) % mod
	print(ans)
	return
t = 1
for i in range(t):
	solve()


import sys
sys.setrecursionlimit(10 ** 5)
num = input()
n = len(num)
ans = 0
mod = 1000000007
tis = [0] * n
sim = int(num[0])
for i in range(1, n):
	tis[i] = (n - i) * sim + i * (i + 1) // 2 * int(num[i])
	sim = sim + int(num[i])
ten = [1]
for _ in range(n):
	ten.append(ten[-1] * 10 % mod)
for i in range(n):
	ans = (ans + tis[n - 1 - i] * ten[i]) % mod
print(ans)


from collections import Counter, OrderedDict
from itertools import permutations as perm
from sys import setrecursionlimit
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
import threading
import math
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
a = gbs()
n = len(a)
p10 = [1]
for i in range(1, n):
	p10.append(10 * p10[-1] % mod)
p = [1]
for i in range(1, n):
	v = (i + 1) * p10[i] % mod + p[-1]
	p.append(v % mod)
p.append(0)
ans = 0
for i in range(n):
	(l, r) = (i, n - 1 - i)
	c = (l * (l + 1) // 2 % mod * p10[r] % mod + p[r - 1]) % mod
	ans += c * a[i] % mod
	ans %= mod
print(ans)


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop, heapify
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
from itertools import accumulate
from functools import lru_cache
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
l = li3()
ans = last = 0
l1 = [0]
for i in l:
	l1.append(l1[-1] * 10 + i)
	l1[-1] = l1[-1] % mod
hel = [0]
for i in range(len(l) - 1):
	hel.append((hel[-1] * 10 + 1) % mod)
hel.reverse()
l2 = []
for i in range(len(l)):
	l2.append(l1[i + 1] * hel[i] % mod)
helpl = [0]
for i in range(len(l) - 1, -1, -1):
	helpl.append(helpl[-1] + l[i] * pow(10, len(l) - i - 1, mod))
	helpl[-1] = helpl[-1] % mod
helpl.reverse()
l3 = []
for i in range(1, len(l)):
	l3.append(helpl[i] * i % mod)
l2.append(0)
ans = 0
l3.append(0)
for i in l2 + l3:
	ans = (ans + i) % mod
print(ans)


s = input()
n = len(s)
m = 1000000007
ans = 0
ten = [1] * (n + 1)
left = [0] * (n + 1)
for i in range(1, n + 1):
	ten[i] = ten[i - 1] * 10 % m
	left[i] = (left[i - 1] + ten[i - 1] * i) % m
sol = 0
for i in range(n):
	sol = (sol + (left[n - i - 1] + (i * i + i * 1) // 2 * ten[n - i - 1]) * int(s[i])) % m
print(sol % m)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def solve():
	MOD = int(1000000000.0 + 7)
	s = minp()
	n = len(s)
	p = [0] * (n + 1)
	pp = [1] * (n + 1)
	p10 = 1
	for i in range(1, n + 1):
		p[i] = (p[i - 1] + p10 * i) % MOD
		pp[i] = p10
		p10 = p10 * 10 % MOD
	res = int(s[0]) * p[n - 1] % MOD
	for i in range(1, n):
		res = (res + int(s[i]) * (p[n - 1 - i] + pp[n - i] * i * (i + 1) // 2)) % MOD
	print(res)
solve()


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
s = input().strip()
md = 10 ** 9 + 7
n = len(s)
an = 0
x = 0
ar = [1, 20]
pr = 100
for i in range(2, 10 ** 5 + 5):
	ar.append((i + 1) * pr % md)
	pr = pr * 10 % md
for i in range(1, len(ar)):
	ar[i] = (ar[i] + ar[i - 1]) % md
ar += [1]
if n > 2:
	for i in range(n):
		x = i * (i + 1) // 2
		if i == 0:
			x = 1
		if i == 1:
			x = 2
		ct = n - i - 2
		cr = ar[ct] * int(s[i]) % md
		cr = (cr + (x - (1 if i < 2 or i == n - 1 else 0)) * int(s[i]) * pow(10, n - i - 1, md)) % md
		an = (an + cr) % md
	print(an)
elif n == 1:
	print(0)
else:
	print(int(s[0]) + int(s[1]))


s = input()
n = len(s)
mod = 10 ** 9 + 7
dp = [0 for _ in range(n)]
ten = [1 for _ in range(n + 1)]
for i in range(1, n + 1):
	ten[i] = ten[i - 1] * 10 % mod
res = 0
for i in range(n - 2, -1, -1):
	dp[i] = (n - i - 1) * ten[n - i - 2] + dp[i + 1]
for i in range(n):
	dp[i] += i * (i + 1) // 2 * ten[n - i - 1]
	res += int(s[i]) * dp[i] % mod
print(res % mod)


s = list(map(int, list(input())))
mod_const = 10 ** 9 + 7
l_const = len(s)
res = 0
discharge = 1
repeat = (l_const - 1) * l_const // 2
multiplier = 0
for i in range(l_const - 1, -1, -1):
	res += discharge * s[i] * repeat
	res += multiplier * s[i]
	multiplier += discharge * (l_const - i)
	multiplier %= mod_const
	discharge *= 10
	discharge %= mod_const
	repeat -= i
print(res % mod_const)


s = input()
mod = 10 ** 9 + 7
n = len(s)
a = [int(s[n - i - 1]) for i in range(n)]
s = [0] * (n + 1)
for i in range(n):
	s[i + 1] = s[i] + i + 1
ss = [0] * (n + 1)
ss[0] = 1
for i in range(n):
	ss[i + 1] = ss[i] + (i + 2) * pow(10, i + 1, mod)
ans = 0
for i in range(n):
	if i != n - 1:
		ans += s[n - i - 1] * a[i] * pow(10, i, mod)
		ans %= mod
	if i != 0:
		ans += ss[i - 1] * a[i]
		ans %= mod
print(ans)


import sys
input = lambda : sys.stdin.readline().rstrip()
m = 10 ** 9 + 7
a = input()
n = len(a)
p = 0
ans = 0
for i in range(n - 1, -1, -1):
	c = pow(10, n - i - 1, m)
	val = c * int(a[i]) * i * (i + 1) // 2
	val %= m
	if i != n - 1:
		p = (p + pow(10, n - 2 - i, m) * (n - i - 1)) % m
	val += p * int(a[i])
	val %= m
	ans = (ans + val) % m
print(ans)


mod = 10 ** 9 + 7
s = input()
n = len(s)
dp = [0] * n
dp[0] = 0
val = ord(s[0]) - ord('0')
total_val = val
for i in range(1, n):
	dp[i] = 10 * dp[i - 1] + (ord(s[i]) - ord('0')) * (i * (i + 1) // 2)
	dp[i] += total_val
	val *= 10
	val += ord(s[i]) - ord('0')
	total_val += val
	val %= mod
	total_val %= mod
	dp[i] %= mod
print(dp[n - 1])


from sys import stdin, stdout
import math
input = stdin.readline
st = input()
n = len(st)
n -= 1
arr = [0, 1]
mod = int(1000000000.0 + 7)
i = 1
for j in range(2, n):
	i = i * 10 % mod
	arr.append(j % mod * i % mod % mod)
po = []
i = 1
for j in range(n):
	po.append(i)
	i = i * 10 % mod
main = [arr[0]]
for i in range(n - 1):
	main.append((main[i] % mod + arr[i + 1] % mod) % mod)
main = main[::-1]
ans = 0
for i in range(n):
	ans += int(st[i]) * po[n - 1 - i] * int(i * (i + 1) / 2) + int(st[i]) * main[i]
	ans = ans % mod
print(ans)


import sys, bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range
R = range

def Golf():
	(n, *t) = map(int, open(0).read().split())

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def MI():
	return map(int, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def NLI(n):
	return [[int(i) for i in input().split()] for i in range(n)]

def NLI_(n):
	return [[int(i) - 1 for i in input().split()] for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RA():
	return map(int, open(0).read().split())

def RLI(n=8, a=1, b=10):
	return [random.randint(a, b) for i in range(n)]

def RI(a=1, b=10):
	return random.randint(a, b)

def INP():
	N = 10
	A = 10
	n = random.randint(1, N)
	a = [random.randint(1, A) for i in range(n)]
	return (n, a)

def Rtest(T):
	(case, err) = (0, 0)
	for i in range(T):
		inp = INP()
		a1 = naive(*inp)
		a2 = solve(*inp)
		if a1 != a2:
			print((a1, a2), inp)
			err += 1
		case += 1
	print('Tested', case, 'case with', err, 'errors')

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
l_alp = string.ascii_lowercase
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()

class SegTree:

	def __init__(self, n, init_val=0, function=lambda a, b: a + b, ide=0):
		self.size = n
		self.ide_ele = ide
		self.num = 1 << (self.size - 1).bit_length()
		self.table = [self.ide_ele] * 2 * self.num
		self.index = [0] * 2 * self.num
		self.lazy = [self.ide_ele] * 2 * self.num
		self.func = function
		if not hasattr(init_val, '__iter__'):
			init_val = [init_val] * self.size
		for (i, val) in enumerate(init_val):
			self.table[i + self.num - 1] = val
			self.index[i + self.num - 1] = i
		for i in range(self.num - 2, -1, -1):
			self.table[i] = self.func(self.table[2 * i + 1], self.table[2 * i + 2])
			if self.table[i] == self.table[i * 2 + 1]:
				self.index[i] = self.index[i * 2 + 1]
			else:
				self.index[i] = self.index[i * 2 + 2]

	def update(self, k, x):
		k += self.num - 1
		self.table[k] = x
		while k:
			k = (k - 1) // 2
			res = self.func(self.table[k * 2 + 1], self.table[k * 2 + 2])
			self.table[k] = res
			if res == self.table[k * 2 + 1]:
				self.index[k] = self.index[k * 2 + 1]
			else:
				self.index[k] = self.index[k * 2 + 2]

	def evaluate(k, l, r):
		if lazy[k] != 0:
			node[k] += lazy[k]
			if r - l > 1:
				lazy[2 * k + 1] += lazy[k] // 2
				lazy[2 * k + 2] += lazy[k] // 2
		lazy[k] = 0

	def query(self, p, q):
		if q <= p:
			return self.ide_ele
		p += self.num - 1
		q += self.num - 2
		res = self.ide_ele
		while q - p > 1:
			if p & 1 == 0:
				res = self.func(res, self.table[p])
			if q & 1 == 1:
				res = self.func(res, self.table[q])
				q -= 1
			p = p >> 1
			q = q - 1 >> 1
		if p == q:
			res = self.func(res, self.table[p])
		else:
			res = self.func(self.func(res, self.table[p]), self.table[q])
		return res

	def query_id(self, p, q):
		if q <= p:
			return self.ide_ele
		p += self.num - 1
		q += self.num - 2
		res = self.ide_ele
		idx = p
		while q - p > 1:
			if p & 1 == 0:
				res = self.func(res, self.table[p])
				if res == self.table[p]:
					idx = self.index[p]
			if q & 1 == 1:
				res = self.func(res, self.table[q])
				if res == self.table[q]:
					idx = self.index[q]
				q -= 1
			p = p >> 1
			q = q - 1 >> 1
		if p == q:
			res = self.func(res, self.table[p])
			if res == self.table[p]:
				idx = self.index[p]
		else:
			res = self.func(self.func(res, self.table[p]), self.table[q])
			if res == self.table[p]:
				idx = self.index[p]
			elif res == self.table[q]:
				idx = self.index[q]
		return idx

	def __str__(self):
		rt = self.table[self.num - 1:self.num - 1 + self.size]
		return str(rt)

class Comb:

	def __init__(self, n, mo=10 ** 9 + 7):
		self.fac = [0] * (n + 1)
		self.inv = [1] * (n + 1)
		self.fac[0] = 1
		self.fact(n)
		for i in range(1, n + 1):
			self.fac[i] = i * self.fac[i - 1] % mo
			self.inv[n] *= i
			self.inv[n] %= mo
		self.inv[n] = pow(self.inv[n], mo - 2, mo)
		for i in range(1, n):
			self.inv[n - i] = self.inv[n - i + 1] * (n - i + 1) % mo
		return

	def fact(self, n):
		return self.fac[n]

	def invf(self, n):
		return self.inv[n]

	def comb(self, x, y):
		if y < 0 or y > x:
			return 0
		return self.fac[x] * self.inv[x - y] * self.inv[y] % mo

class UnionFind:

	def __init__(self, n):
		self.table = [-1] * n

	def _root(self, x):
		if self.table[x] < 0:
			return x
		else:
			self.table[x] = self._root(self.table[x])
			return self.table[x]

	def find(self, x, y):
		return self._root(x) == self._root(y)

	def union(self, x, y):
		r1 = self._root(x)
		r2 = self._root(y)
		if r1 == r2:
			return
		d1 = self.table[r1]
		d2 = self.table[r2]
		if d1 <= d2:
			self.table[r2] = r1
			if d1 == d2:
				self.table[r1] -= 1
		else:
			self.table[r1] = r2

	def __str__(self):
		rt = [i if j < 0 else j for (i, j) in enumerate(self.table)]
		return str(rt)
show_flg = False
show_flg = True
ans = 0
s = [int(i) for i in input()][::-1]
n = len(s)
cm = Comb(n + 10)
R = 0
L = n * (n - 1) // 2 % mo
D = 1
m = n - 1
d = 1
for i in range(n):
	c = s[i]
	ans += c * (R + L * D)
	R += D * d
	d += 1
	L -= m
	m -= 1
	D *= 10
	D %= mo
	R %= mo
	L %= mo
print(ans % mo)


import sys, os, io
s = input()
n = len(s)
a = [0] * n
mod = 10 ** 9 + 7
for i in range(n - 2, -1, -1):
	a[i] = a[i + 1] + (n - i - 1) * pow(10, n - i - 2, mod)
	a[i] %= mod
ans = 0
for i in range(n):
	val = int(s[i]) * pow(10, n - i - 1, mod)
	times = i * (i + 1) // 2
	ans += val * times % mod
	ans += int(s[i]) * a[i]
	ans %= mod
print(ans)


import sys
read = lambda : sys.stdin.readline().strip()
readi = lambda : map(int, read().split())
from collections import *
num = read()
n = len(num)
total = 0
mod = 10 ** 9 + 7
prefixSum = [0] * (n + 1)
total = 0
for i in range(n):
	prefixSum[i + 1] = prefixSum[i] + int(num[i])
for i in range(1, n + 1):
	prefixSum[i] *= n - i
for i in range(2, n + 1):
	total = (total + (i - 1) * i // 2 % mod * int(num[i - 1]) * pow(10, n - i, mod)) % mod
	total = (total + prefixSum[i - 1] * pow(10, n - i, mod) % mod) % mod
print(total)


N = input()
n = len(N)
MOD = 1000000007
pre = 0
wei = 1
suf = 1
ans = 0
lst = int(N[-1])
lst_n = int(N[-1])
for (i, a) in enumerate(N[-2::-1], 2):
	wei = wei * 10 % MOD
	a = int(a)
	pre = (suf * a % MOD + ans) % MOD
	ans = (pre + lst) % MOD
	lst_n = (a * wei + lst_n) % MOD
	lst = (lst + lst_n) % MOD
	suf = (suf + i * wei % MOD) % MOD
print(ans)


num = input()
n = len(num)
ans = 0
mod = 1000000007
tis = [0] * n
sim = int(num[0])
ans = 0
for i in range(1, n):
	tis[i] = ((n - i) * sim + i * (i + 1) // 2 * int(num[i])) % mod
	sim = (sim + int(num[i])) % mod
ten = [1]
for _ in range(n):
	ten.append(ten[-1] * 10 % mod)
for i in range(n):
	ans = (ans + tis[n - 1 - i] * ten[i]) % mod
print(ans)


s = [int(c) for c in input()][::-1]
n = len(s)
mod = 1000000007

def inv(x):
	return pow(x, mod - 2, mod)
teninv = inv(10)
P = [0]
p = 1
for x in s:
	P.append((P[-1] + x * p) % mod)
	p = p * 10 % mod
Q = [0]
for i in range(n + 1):
	Q.append((Q[-1] + P[i] * pow(teninv, i, mod)) % mod)
s = 0
for l in range(n):
	first = P[l] - P[0]
	s += (n - l) * first % mod
	s += P[n] * inv(9) % mod * (1 - inv(pow(10, n - l, mod))) % mod
	d = Q[n + 1] - Q[l + 1]
	s = (s - d * inv(pow(teninv, l, mod)) % mod) % mod
print(s % mod)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9 + 7
n = list(input())
k = 1
n = n[::-1]
l = len(n)
r = 0
c = 0
for i in range(l):
	d = c + (l - i) * (l - i - 1) // 2 * k
	d %= mod
	c += k * (i + 1)
	c %= mod
	r += int(n[i]) * d
	r %= mod
	k *= 10
	k %= mod
r %= mod
print(r)


MOD = 10 ** 9 + 7

def ahead(n, ab):
	if ab == 0:
		return 0
	return ab * (ab + 1) // 2 * int(n[ab]) * pow(10, len(n) - ab - 1, MOD) % MOD
n = input()
ans = 0
curr = 0
for ab in range(len(n) - 1, -1, -1):
	pl = len(n) - ab - 1
	ah = ahead(n, ab)
	if pl != 0:
		curr += pl * pow(10, pl - 1, MOD) % MOD
	ans += int(n[ab]) * curr
	ans += ah
	ans %= MOD
print(ans % MOD)


import functools
MOD = 10 ** 9 + 7
a = input()
m = len(a)
total = 0
p = 1
for i in range(m - 1, 0, -1):
	d = int(a[i])
	total = (total % MOD + (i + 1) * i // 2 * d * p % MOD) % MOD
	p = 10 * p % MOD
x = 0
p = 1
for i in range(m - 2, -1, -1):
	d = int(a[i])
	s = m - i - 1
	x = (x % MOD + p * s % MOD) % MOD
	total = (total % MOD + x * d % MOD) % MOD
	p = 10 * p % MOD
print(total % MOD)


mo = 1000000007
s = input()
v = 0
(v1, s1) = (0, 0)
(v2, s2) = (0, 0)
for i in range(len(s)):
	c = int(s[i])
	v2 = (v2 * 10 + v1 * 10 + (s2 + s1) * c) % mo
	s2 = s2 + s1
	v1 = (v1 + v) % mo
	s1 = s1 + 1
	v = (v * 10 + c) % mo
print((v1 + v2) % mo)


import random
if 1:
	s = input()
	n = len(s)
	s = [s[n - i - 1] for i in range(n)]
else:
	n = int(input())
	s = [random.randint(0, 9) for i in range(n)]
mod = 10 ** 9 + 7
ans = 0
X = 0
S = 0
S2 = 0
inv = pow(2, mod - 2, mod)
inv_10 = pow(10, mod - 2, mod)
for i in range(n):
	tmp = pow(10, i, mod) * ((n - i - 1) * (n - i) * inv) + S2 * pow(10, i + mod - 2, mod)
	tmp %= mod
	tmp *= int(s[i])
	tmp %= mod
	ans += tmp
	ans %= mod
	S += pow(inv_10, i, mod)
	S %= mod
	S2 += S
	S %= mod
print(ans)


a = input()
n = len(a)
b = 0
c = 0
d = []
e = 1
for i in range(n):
	d.append(e)
	e *= 10
	e %= 10 ** 9 + 7
b = 0
for i in range(n):
	b += int(a[i])
c = 0
for i in range(n - 1, 0, -1):
	b -= int(a[i])
	c += (int(a[i]) * ((i + 1) * i // 2) + b * (n - i)) * d[n - 1 - i]
	c %= 10 ** 9 + 7
print(c)


mod_n = 10 ** 9 + 7
remainders = dict()

def precalc_remainders(n):
	x = 1
	for i in range(n + 1):
		remainders[i] = x
		x = x * 10 % mod_n

def get_remainder(digit, pos):
	return remainders[pos] * digit % mod_n

def add_mod(result, value):
	return (result + value) % mod_n

def sum_of_edits_old(num):
	n = len(num)
	result = 0
	for pos in range(n):
		digit = int(num[n - 1 - pos])
		remainder = get_remainder(digit, pos)
		result = add_mod(result, remainder * (n - pos - 1) * (n - pos) // 2)
		for k in range(1, pos + 1):
			new_remainder = get_remainder(digit, pos - k)
			result = add_mod(result, new_remainder * (pos - k + 1))
	return result

def sum_of_edits(num):
	n = len(num)
	result = 0
	accumulated_counts = 0
	for pos in range(n):
		digit = int(num[n - 1 - pos])
		remainder = get_remainder(digit, pos)
		result = add_mod(result, remainder * (n - pos - 1) * (n - pos) // 2)
		result = add_mod(result, digit * accumulated_counts)
		accumulated_counts = add_mod(accumulated_counts, remainders[pos] * (pos + 1))
	return result
num = input()
precalc_remainders(len(num))
result = sum_of_edits(num)
print(result)


n = input()
mod = 1000000007
sz = 100001
tenMod = [0] * sz
tenMod[0] = 1
for _ in range(1, sz):
	tenMod[_] = tenMod[_ - 1] * 10 % mod
prec = [0] * sz
prec[0] = 0
for _ in range(1, sz):
	prec[_] = (prec[_ - 1] + _ * tenMod[_ - 1]) % mod
ans = 0
for _ in range(len(n)):
	ans += (int(n[_]) * prec[len(n) - 1 - _] % mod + int(n[_]) * tenMod[len(n) - _ - 1] * ((_ + 1) * _ // 2) % mod % mod) % mod
	ans %= mod
print(ans)


import math
mod = int(1000000000.0 + 7)

def mul(a, b):
	return a * b % mod

def addmod(a, b):
	a = a + b
	if a >= mod:
		a -= mod
	return a
s = input()
n = len(s)
pow10 = [0] * (n + 1)
pow10[0] = 1
for i in range(1, n + 1):
	pow10[i] = mul(pow10[i - 1], 10)
right = [0] * (n + 1)
for i in range(1, n + 1):
	right[i] = mul(i, pow10[i - 1])
for i in range(1, n + 1):
	right[i] += right[i - 1]
	if right[i] >= mod:
		right[i] -= mod
ans = 0
for i in range(n):
	d = s[i]
	d = int(d)
	ans += mul(right[n - i - 1], d)
	ans %= mod
	pref = i * (i + 1) // 2
	ans += mul(d, mul(pref, pow10[n - i - 1]))
	ans %= mod
print(ans)


p = 10 ** 9 + 7
z = 0
v = 0
s = input()
s = s[::-1]
n = len(s)
for (i, dx) in enumerate(s):
	d = int(dx)
	z += pow(10, i, p) * d * (((n - i - 1) * (n - i - 2) // 2 + (n - i - 1)) % p)
	z %= p
	if i > 0:
		v += i * pow(10, i - 1, p)
	v %= p
	z += d * v
	z %= p
print(z)


s = input()
n = len(s)
p = 10 ** 9 + 7
s += 'g'
s = s[::-1]
wyn = 0
acum = 0
pot = [1] * (10 ** 5 + 5)
for i in range(1, 10 ** 5 + 5):
	pot[i] = pot[i - 1] * 10 % p
for i in range(1, n + 1):
	lic = int(s[i])
	wyn += acum * lic
	wyn += lic * pot[i - 1] * (n - i + 1) * (n - i) // 2
	acum += i * pot[i - 1]
print(wyn % p)


MOD = 1000000007
n = input()
(pw, val) = ([1], [0])
for i in range(1, 100100):
	val.append((val[i - 1] + i * pw[i - 1]) % MOD)
	pw.append(pw[i - 1] * 10 % MOD)
(res, pos) = (0, len(n))
for i in n:
	res = res + val[pos - 1] * int(i)
	res %= MOD
	rem = len(n) - pos
	res = res + int((rem * rem + rem) / 2) * pw[pos - 1] * int(i)
	res %= MOD
	pos -= 1
print(res)


import sys
input = sys.stdin.readline

def print(val):
	sys.stdout.write(str(val) + '\n')

def prog():
	mod = 10 ** 9 + 7
	n = input().strip()[::-1]
	psum1 = [0] * (10 ** 5 + 1)
	psum2 = [0] * (10 ** 5 + 1)
	psum11 = [0] * (10 ** 5 + 1)
	psum22 = [0] * (10 ** 5 + 1)
	tens = [1] * (10 ** 5 + 1)
	tens_inv = [1] * (10 ** 5 + 1)
	for i in range(1, len(n)):
		tens[i] = tens[i - 1] * 10 % mod
	tens_inv[len(n) - 1] = pow(pow(10, len(n) - 1, mod), mod - 2, mod)
	for i in range(len(n) - 2, -1, -1):
		tens_inv[i] = tens_inv[i + 1] * 10 % mod
	for i in range(len(n)):
		psum1[i + 1] = (psum1[i] + int(n[i]) * tens[i]) % mod
	for i in range(len(n) - 1, -1, -1):
		psum2[i] = (psum2[i + 1] + int(n[i]) * tens[i]) % mod
	for i in range(len(n)):
		psum11[i + 1] = (psum11[i] + psum1[i + 1]) % mod
	for i in range(len(n) - 1, -1, -1):
		psum22[i] = (psum22[i + 1] + psum2[i]) % mod
	ans = 0
	for i in range(1, len(n)):
		ans = (ans + psum11[len(n) - i] + psum22[i] * tens_inv[i]) % mod
	print((ans + mod) % mod)
prog()


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c for j in range(b)] for i in range(a)]

def list3d(a, b, c, d):
	return [[[d for k in range(c)] for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** (-10)
S = input()
N = len(S)
suf = [0] * (N + 1)
for i in range(N - 1, -1, -1):
	suf[i] = (suf[i + 1] + int(S[i]) * pow(10, N - i - 1, MOD)) % MOD
for i in range(N - 1, -1, -1):
	suf[i] += suf[i + 1]
	suf[i] %= MOD
pre = [0] * (N + 1)
for i in range(N - 1):
	pre[i + 1] = (pre[i] * 10 + int(S[i])) % MOD
for i in range(N):
	pre[i + 1] += pre[i]
	pre[i + 1] %= MOD
ans = 0
for i in range(N - 1, -1, -1):
	ans += pre[i] * pow(10, N - i - 1, MOD) + suf[i + 1]
	ans %= MOD
print(ans)


d = input()
(n, MOD) = (len(d), 10 ** 9 + 7)
(sm, m) = (0, 1)
for i in range(n - 1):
	tail = m * int(d[-i - 1]) % MOD
	m = m * 10 % MOD
	p = ((n - i - 1) * (n - i - 2) // 2 + n - i - 1) % MOD
	sm = (sm + tail * p) % MOD
(cc, m) = ([0] * n, 1)
for i in range(n):
	(cc[i], m) = ((i + 1) * m % MOD, m * 10 % MOD)
for i in range(1, n):
	cc[i] = (cc[i] + cc[i - 1]) % MOD
for i in range(n - 1):
	sm = (sm + cc[-i - 2] * int(d[i])) % MOD
print(sm)


MOD = 10 ** 9 + 7

def mul(x, y):
	global MOD
	return x % MOD * (y % MOD) % MOD

def add(x, y):
	global MOD
	return (x % MOD + y % MOD) % MOD

def testcase():
	n = input()
	dp = [0 for _ in n]
	dp[-1] = 0
	temp = 1
	for i in range(len(n) - 2, -1, -1):
		dp[i] = add(dp[i + 1], mul(temp, len(n) - i - 1))
		temp = mul(temp, 10)
	ans = 0
	for i in range(len(n)):
		d = int(n[i])
		r = mul(dp[i], d)
		ans = add(ans, r)
	temp = 1
	for i in range(len(n) - 1, 0, -1):
		d = int(n[i])
		l = d
		l = mul(d, mul(mul(i, i + 1), 500000004))
		l = mul(l, temp)
		temp = mul(temp, 10)
		ans = add(ans, l)
	print(ans)
	return
t = 1
for _ in range(t):
	testcase()


import sys
input = sys.stdin.buffer.readline
a = list(input())
mod = 10 ** 9 + 7
while a[-1] <= 47:
	a.pop()
n = len(a)
a.append(0)
a = a[::-1]
res = 0
b = 0
ten = 1
back = pow(810, mod - 2, mod)
for j in range(1, n + 1):
	A = a[j] - 48
	if j != 1:
		s = (9 * pow(10, j, mod) * j % mod - 10 * (pow(10, j, mod) - 1)) * back % mod
		res = (res + A * s) % mod
	t = n - j
	if t == 0:
		res = (res + A * pow(10, j - 1, mod)) % mod
	elif t == 1:
		res = (res + 2 * A * pow(10, j - 1, mod)) % mod
	else:
		res = (res + A * (t + 1 + t * (t - 1) // 2) * pow(10, j - 1, mod)) % mod
	b = (b + A * ten) % mod
	ten = ten * 10 % mod
res = (res - b) % mod
print(res)


import sys
if not sys.warnoptions:
	import warnings
	warnings.simplefilter('ignore')

def ii():
	return int(input())

def li():
	return [int(i) for i in input().split()]

def ls():
	return [i for i in input().split()]
MOD = 1000000007
n = input()
p = []
suff = [1]
total = 1
for i in range(100001):
	p.append(total)
	total = total * 10 % MOD
for i in range(1, 100001):
	x = ((i + 1) * p[i] + suff[i - 1]) % MOD
	suff.append(x)
l = len(n)
total = 0
for i in range(l):
	x = int(n[i])
	if l - i - 2 >= 0:
		total = (total + i * (i + 1) // 2 * x * p[l - i - 1] + x * suff[l - i - 2]) % MOD
	else:
		total = (total + i * (i + 1) // 2 * x * p[l - i - 1]) % MOD
print(total)


s = input()
n = len(s)
mod = 1000000007
ans = 0
fact = 1
left = n * (n - 1) // 2 % mod
right = 0
for i in range(n):
	ans = (ans + right * int(s[n - 1 - i])) % mod
	ans = (ans + left * fact * int(s[n - 1 - i])) % mod
	right = (right + (i + 1) * fact) % mod
	fact = fact * 10 % mod
	left = (left - (n - 1 - i)) % mod
print(ans)


n = list(map(int, input()))
mod = 10 ** 9 + 7
ans = 0
tens = [1]
mults = [1]
cur = 0
prefix = []
suffix = []
for ch in n:
	cur = cur * 10 + ch
	cur %= mod
	prefix.append(cur)
pow10 = 1
cur = 0
suffix = []
for ch in n[::-1]:
	cur = cur + ch * pow10
	cur %= mod
	pow10 *= 10
	pow10 %= mod
	tens.append(pow10)
	mults.append((pow10 + mults[-1]) % mod)
	suffix.append(cur)
ans = 0
for i in range(len(n)):
	ans += suffix[i] * (len(n) - i - 1)
	ans %= mod
for i in range(len(n) - 1):
	ans += prefix[i] * mults[-3 - i]
	ans %= mod
print(ans % mod)


from sys import stdin, stdout
import math
import heapq
import collections
input = stdin.readline

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputstrings():
	return [x for x in input().split()]

def inputstringnum():
	return [ord(x) - ord('0') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
s = inputstringnum()
mod = 1000000007
n = len(s) - 1
ans = 0
res = 0
sm = 0
pw = 1
for i in reversed(range(0, n)):
	res = (10 * res + sm) % mod
	ans = (ans + (1 * i * (i + 1) // 2 % mod * pw + res) % mod * s[i]) % mod
	sm = (sm + pw) % mod
	pw = 10 * pw % mod
print(ans)


s = input()
n = len(s)
(multi, curr) = (0, 0)
mod = 10 ** 9 + 7
for (j, i) in enumerate(s[::-1]):
	a = int(i)
	curr = (curr + (n - j) * (n - j - 1) // 2 * a * pow(10, j, mod) + multi * a) % mod
	multi = (multi + pow(10, j, mod) * (j + 1)) % mod
print(curr)


import sys
from sys import stdin
mod = 10 ** 9 + 7
n = stdin.readline()[:-1]
ans = 0
ns = 0
for lp in range(len(n)):
	ind = len(n) - 1 - lp
	pw = pow(10, lp, mod)
	ans += ns * int(n[ind])
	ans += int(n[ind]) * pw * ind * (ind + 1) // 2
	ans %= mod
	ns += (lp + 1) * pw
	ns %= mod
print(ans)


S = list(map(int, list(input())))
mod = 10 ** 9 + 7
n = len(S)
(ans, s, p) = (0, 0, 1)
for i in reversed(range(n)):
	k = (i * (i + 1) // 2 * p + s) % mod
	s += p * (n - i)
	p = p * 10 % mod
	ans += S[i] * k
	ans %= mod
print(ans)


import sys

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def string(s):
	return ''.join(s)

def fori(n):
	return [fi() for i in range(n)]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def bo(i):
	return ord(i) - ord('A')

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def cil(n, m):
	return n // m + int(n % m > 0)

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j):
	return 0 <= i < n and 0 <= j < m and (a[i][j] != '.')

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = 1
while t > 0:
	t -= 1
	s = si()
	n = len(s)
	for i in range(len(s)):
		s[i] = int(s[i])
	d = [[0] * (n + 2) for i in range(10)]
	ans = 0
	mod = 10 ** 9 + 7
	for i in range(n):
		ans = (ans + (i * i + i) // 2 * s[i] * pow(10, n - i - 1, mod)) % mod
	for i in range(n):
		d[s[i]][n - i - 1] += 1
	for i in range(1, 10):
		c = su = 0
		for j in range(n, -1, -1):
			ans = (ans + pow(10, j, mod) * (c * (j + 1)) * i) % mod
			if d[i][j]:
				c += 1
				su += j + 1
	print(ans)


from itertools import accumulate

def power(a, b, mod):
	res = 1
	while b:
		if b % 2:
			res = res * a % mod
		b //= 2
		a = a * a % mod
	return res % mod
num = [int(i) for i in input().strip()]
n = len(num)
ans = 0
MOD = 10 ** 9 + 7
pf = list(accumulate(num))
for i in range(n - 2, -1, -1):
	current = power(10, i, MOD)
	query = (pf[n - i - 2] * (i + 1) + num[n - i - 1] * ((n - i - 1) * (n - i) // 2)) % MOD
	current = current * query % MOD
	ans = (ans + current) % MOD
print(ans)


n = input()[::-1]
mod = 10 ** 9 + 7
l = len(n)
out = 0
sp = 0
for i in range(l):
	v = l - i - 1
	vv = v * (v + 1) // 2
	s = vv * pow(10, i, mod) % mod
	if i > 0:
		sp += i * pow(10, i - 1, mod) % mod
	s = int(n[i]) * (s + sp)
	out += s % mod
	out %= mod
print(out)


s = str(input())
c = len(s)
k = c
ans = 0
m = 10 ** 9 + 7
l = [1] * (c + 1)
kkk = 1
for i in range(1, c + 1):
	l[i] = (kkk * 10 * (i + 1) + l[i - 1]) % m
	kkk = kkk * 10 % m
for i in range(c):
	if s[i] == '0':
		continue
	tt = int(s[i])
	h = c - i - 1
	if h > 0:
		ans = (ans + l[h - 1] * tt) % m
	kk = i * (i + 1) // 2 * pow(10, h, m) * tt % m
	ans = (ans + kk) % m
print(ans)


import sys
import math
import collections
import heapq
import decimal
input = sys.stdin.readline
mod = 1000000007
s = input()
n = len(s) - 1
s1 = 0
p = 1
s2 = 0
for i in range(n - 1, -1, -1):
	s1 = (s1 + int(s[i]) * (i * (i + 1) // 2 % mod * p % mod + s2) % mod) % mod
	s2 = (s2 + p * (n - i) % mod) % mod
	p = p * 10 % mod
print(s1)


import sys
import heapq
import copy
import math
import decimal
input = sys.stdin.readline

def binary_exponentiation(a, b):
	ans = 1
	while b != 0:
		bit = b % 2
		if bit == 1:
			ans = ans * a
		a = a * a
		b = b // 2
	return ans

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def insr2():
	s = input()
	s = list(s[:len(s) - 1])
	s = [ord(s[i]) - ord('a') for i in range(len(s))]
	return s

def invr():
	return map(int, input().split())
ans = 0

def pr_list(a):
	print(*a, sep=' ')

def swap(a, b):
	temp = a
	a = b
	b = temp
	return [a, b]

def pri(a, b):
	s = '? ' + str(a) + ' ' + str(b)
	print(s)
	sys.stdout.flush()
result = []

def nCk(arr, itr, k, n):
	if len(arr) == k:
		result.append(arr)
		return
	if len(arr) > k or itr == n + 1:
		return
	nCk(arr + [itr], itr + 1, k, n)
	nCk(arr, itr + 1, k, n)
	return

def nPk(arr, itr, k, n):
	if len(arr) == k:
		result.append(arr)
		return
	if len(arr) > k or itr == n + 1:
		return
	for i in range(len(arr) + 1):
		nPk(arr[0:i] + [itr] + arr[i:len(arr)], itr + 1, k, n)
	nPk(arr, itr + 1, k, n)
	return

def main():
	tests = 1
	mod = 1000000007
	limit = 10 ** 18
	ans = 0
	stack = []
	arr = []
	heapq.heapify(arr)
	for test in range(tests):
		s = insr()
		ans = 0
		n = len(s)
		ten = [1]
		right = [0, 1]
		tens = 10
		for i in range(n + 1):
			ten.append(ten[-1] * 10 % mod)
			right.append((right[-1] + (i + 2) * tens) % mod)
			tens = tens * 10 % mod
		for i in range(n):
			left = i
			r = n - 1 - i
			l = left * (left + 1) // 2 * ten[r] % mod
			ans = (ans + int(s[i]) * (l + right[r])) % mod
		print(ans)
main()


import io
import os
from collections import Counter, defaultdict, deque

def solve(S):
	MOD = 10 ** 9 + 7
	A = [int(d) for d in S]
	N = len(A)
	pref = [0]
	for x in A:
		pref.append((pref[-1] * 10 + x) % MOD)
	prefpref = [0]
	for x in pref:
		prefpref.append((prefpref[-1] + x) % MOD)
	pows = [1]
	for i in range(N + 1):
		pows.append(pows[-1] * 10 % MOD)
	total = 0
	suff = 0
	for i in reversed(range(N)):
		x = prefpref[i + 1] * pows[N - 1 - i] + (i + 1) * suff
		total += x
		total %= MOD
		suff = (A[i] * pows[N - 1 - i] + suff) % MOD
	return total % MOD
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
N = input().decode().strip()
ans = solve(N)
print(ans)


import os
import sys
from io import BytesIO, IOBase

def main():
	n = input()
	MOD = 10 ** 9 + 7
	leftMultiplier = pow(10, len(n) - 1, MOD)
	invTen = pow(10, MOD - 2, MOD)
	invNine = pow(9, MOD - 2, MOD)
	ans = 0
	for i in range(len(n)):
		k = int(n[i])
		ans += k * (i * (i + 1) // 2) * leftMultiplier
		leftMultiplier *= invTen
		ans %= MOD
		leftMultiplier %= MOD
	rightMultiplier = 0
	for i in range(len(n) - 1, -1, -1):
		k = int(n[i])
		ans += k * rightMultiplier
		rightMultiplier *= 10
		rightMultiplier += (pow(10, len(n) - i, MOD) - 1) * invNine
		rightMultiplier %= MOD
		ans %= MOD
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write('\n'.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
INF = float('inf')
mod = 10 ** 9 + 7
n = data()
n1 = len(n)
s = [0]
t = 1
for i in range(1, n1):
	s1 = (s[-1] + i * t) % mod
	s.append(s1)
	t = t * 10 % mod
ans = 0
t = 1
for i in range(n1 - 1, -1, -1):
	ans = (ans + (s[n1 - i - 1] + (i + 1) * i * t // 2) * int(n[i])) % mod
	t = t * 10 % mod
out(ans)


import math, sys, bisect, heapq
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
int1 = lambda x: int(x) - 1
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))
ilelec = lambda : map(int1, input().split())
alelec = lambda : list(map(int1, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]
MOD = 1000000000 + 7

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
n = input()
m = len(n)
pre = [0]
d = 1
res = 0
for i in range(1, m + 2):
	res += d * i
	res %= MOD
	d *= 10
	d %= MOD
	pre.append(res)
ans = 0
d = 1
for i in range(m - 1, -1, -1):
	x = int(n[i])
	ans += d * (i * (i + 1) // 2 % MOD) % MOD * x % MOD
	ans %= MOD
	ans += pre[m - i - 1] * x % MOD
	ans %= MOD
	d *= 10
	d %= MOD
print(ans)


u = list(map(int, list(input())))
q = 10 ** 9 + 7
n = len(u)
pr = u[:]
for i in range(n):
	pr[i] *= pow(10, n - i - 1, q)
	pr[i] %= q
for i in range(n - 2, -1, -1):
	pr[i] += pr[i + 1]
	pr[i] %= q
prpr = pr[:]
for i in range(n - 2, -1, -1):
	prpr[i] += prpr[i + 1]
	prpr[i] %= q
ans = 0
pw10 = [1] * (n + 1)
for i in range(1, n + 1):
	pw10[i] = pw10[i - 1] * 10
	pw10[i] %= q
for i in range(1, n + 1):
	pw10[i] += pw10[i - 1]
	pw10[i] %= q
for i in range(1, n):
	cur = u[i - 1] * pw10[n - i - 1] % q
	ans += prpr[i] + cur
	ans %= q
	u[i] += u[i - 1] * 10
	u[i] %= q
print(ans)


import sys
import io, os
mod = 10 ** 9 + 7

def solve(s):
	(pref, suff) = ([0], [0])
	l = [int(i) for i in s if i != '\n']
	for i in range(len(l)):
		pref.append((pref[-1] * 10 + l[i]) % mod)
	prefpref = [0]
	for i in range(1, len(pref)):
		prefpref.append((pref[i] + prefpref[-1]) % mod)
	pows = [1]
	for i in range(len(l) + 1):
		pows.append(pows[-1] * 10 % mod)
	for i in range(len(l)):
		suff.append((suff[-1] + l[-i - 1] * pows[i]) % mod)
	(prefpref, suff) = (prefpref[:-1], suff[:-1])
	prefpref.reverse()
	ans = 0
	n = len(l)
	for i in range(n):
		ans += prefpref[i] * pows[i] + suff[i] * (n - i)
		ans %= mod
	return ans % mod
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
N = input().decode().strip()
ans = solve(N)
print(ans)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]

def natural(a):
	return a * (a - 1) // 2
old = data()
s = list(map(int, old))
s = s[::-1]
n = len(s)
answer = 0
temp = 0
ten = 1
for i in range(n):
	answer = (answer + s[i] * (natural(n - i) * ten + temp)) % mod
	temp = (i + 1) * ten + temp
	ten *= 10
	temp %= mod
	ten %= mod
out(answer)


import math
first = []
second = []
number = input()
curr = 0
counter = 1
temp = []
for i in range(len(number)):
	curr += int(number[len(number) - i - 1]) * counter
	if len(temp) > 0:
		temp.append(curr + temp[-1])
	else:
		temp.append(curr)
	counter = counter * 10 % 1000000007
for i in range(len(temp)):
	second.append(temp[len(temp) - i - 1])
second.append(0)
curr = 0
for i in range(len(number)):
	calculate = curr * (pow(10, len(number) - i, 1000000007 * 9) - 1) // 9
	first.append(calculate)
	curr = (curr * 10 + int(number[i])) % (1000000007 * 9)
total = 0
for i in range(len(number)):
	total += first[i]
	total += second[i + 1]
print(int(total) % 1000000007)


a = input()
total = 0
pri = pow(10, 9) + 7
t1 = 0
ans = [1]
for i in range(len(a) + 2):
	ans.append(10 * ans[-1])
	ans[-1] %= pri
t1 = 0
for i in range(len(a) - 1):
	t1 += ans[i] * (i + 1)
	t1 %= pri
for i in range(len(a)):
	m = ans[len(a) - i - 1] * (i * (i + 1) // 2) * int(a[i])
	m %= pri
	total += m
	total += int(a[i]) * t1 % pri
	total %= pri
	t1 -= (len(a) - i - 1) * ans[len(a) - i - 2]
	t1 %= pri
total %= pri
print(total)


import sys
input = sys.stdin.readline
MOD = 10 ** 9 + 7
s = input().rstrip()
n = len(s)
ans = 0
mod81 = pow(81, MOD - 2, MOD)
for (i, ch) in enumerate(s):
	t = n - i - 1
	ret = int(ch) * (9 * pow(10, t, MOD) * t - pow(10, t, MOD) + 1) * mod81
	if i > 0:
		ret += int(ch) * ((i + 1) * i // 2 * pow(10, t, MOD))
	ans += ret
	ans %= MOD
print(ans)


import sys
z = sys.stdin.readline
M = 10 ** 9 + 7
n = [*map(int, z().strip())]
l = len(n)
p = [0]
for i in range(l):
	p.append(p[-1] + n[i])
s = 0
v = (l * l - l) // 2
d = 1
for i in range(1, l):
	r = p[l - i] * i + v * n[l - i]
	s = (s + r * d) % M
	d = d * 10 % M
	v -= l - i
print(s)


from itertools import accumulate
import sys as _sys

def main():
	t = 1
	for i_t in range(t):
		s_n = _read_line()
		result = find_cost_modification_variants_sum(s_n, base=10, mod=10 ** 9 + 7)
		print(result)

def _read_line():
	result = _sys.stdin.readline()
	assert result[-1] == '\n'
	return result[:-1]

def _read_ints():
	return map(int, _read_line().split())

def find_cost_modification_variants_sum(s_cost, base, mod):
	digits_n = len(s_cost)
	result = 0
	r = 0
	base_pow_r_moded = base ** r % mod
	x_mod_base_pow_r_moded = int(s_cost[digits_n - 1 - r]) * base_pow_r_moded % mod
	get_variants_n_moded = lambda r: (digits_n - 1 - r if r != digits_n - 1 else 1) % mod
	variants_n_moded = get_variants_n_moded(r)
	while r < digits_n - 1:
		result += x_mod_base_pow_r_moded * variants_n_moded % mod
		result %= mod
		r += 1
		base_pow_r_moded *= base % mod
		base_pow_r_moded %= mod
		x_mod_base_pow_r_moded += int(s_cost[digits_n - 1 - r]) * base_pow_r_moded % mod
		x_mod_base_pow_r_moded %= mod
		variants_n_moded = get_variants_n_moded(r)
	sum_base_pow_b_moded = [base ** 0 % mod]
	while len(sum_base_pow_b_moded) < digits_n:
		prev = sum_base_pow_b_moded[-1]
		curr = prev * base % mod
		sum_base_pow_b_moded.append(curr)
	sum_base_pow_b_moded = list(accumulate(sum_base_pow_b_moded))
	a = digits_n - 1
	curr_x_shifted_by_a_moded = int(s_cost[0]) % mod
	while a > 0:
		max_b = a - 1
		result += curr_x_shifted_by_a_moded * sum_base_pow_b_moded[max_b] % mod
		result %= mod
		a -= 1
		curr_x_shifted_by_a_moded *= base % mod
		curr_x_shifted_by_a_moded += int(s_cost[digits_n - 1 - a]) % mod
		curr_x_shifted_by_a_moded %= mod
	return result
main()


n = input()
x = len(n)
s = [int(n[0])]
for i in range(1, x):
	s.append(s[-1] + int(n[i]))
pows = {0: 1}
for i in range(1, x + 1):
	pows[i] = pows[i - 1] * 10 % (10 ** 9 + 7)
S = 0
for i in range(x - 1):
	S += (s[i] * (x - i - 1) + (i + 1) * (i + 2) // 2 * int(n[i + 1])) * pows[x - i - 2]
	S = S % (10 ** 9 + 7)
print(S)


n = input()
MOD = 10 ** 9 + 7
total = 0

def add(num):
	global total
	total += num
	total %= MOD

def mult10(num):
	return (num << 3) + (num << 1)
K = []
k = 1
for i in range(1, len(n)):
	K.append(k)
	k = mult10(k) + 1
	k %= MOD
if len(n) > 1:
	k = 1
	l = 10
	left = int(n[0])
	right = int(n[-1])
	for i in range(1, len(n)):
		add((len(n) - i) * right)
		add(K[-i] * left)
		right += l * int(n[-(i + 1)])
		right %= MOD
		left = mult10(left) + int(n[i])
		left %= MOD
		l = mult10(l)
		l %= MOD
	print(total)
else:
	print(0)


import sys
input = sys.stdin.readline

def insr():
	s = input()
	return list(s[:len(s) - 1])
ppp = 10 ** 9 + 7
string = insr()
n = len(string)
a = [0] * n
b = [0] * n
e = [0] * n
e[0] = int(string[0])
for i in range(1, n):
	c = int(string[i])
	a[i] = ((a[i - 1] + b[i - 1]) * 10 + c * (i * (i + 1)) // 2) % ppp
	b[i] = (b[i - 1] + e[i - 1]) % ppp
	e[i] = (e[i - 1] * 10 + c) % ppp
print((a[n - 1] + b[n - 1]) % ppp)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def print_list(l):
	print(' '.join(map(str, l)))
s = input()
n = len(s)
M = 1000000007
dic = [[0] * n for _ in range(10)]
dic2 = [[0] * n for _ in range(10)]
for k in range(1, 10):
	dic[k][0] = k
	for i in range(1, n):
		dic[k][i] = dic[k][i - 1] * 10 % M
	for i in range(n):
		dic2[k][i] = dic[k][i] * (i + 1) % M
	for i in range(1, n):
		dic2[k][i] = (dic2[k][i - 1] + dic2[k][i]) % M
	dic2[k].append(0)
res = 0
for i in range(n):
	if s[i] != '0':
		k = int(s[i])
		res += dic2[k][n - i - 2]
		res += dic[k][n - i - 1] * ((i * (i + 1) >> 1) % M) % M
		res %= M
print(res)


s = list(map(int, input()))
n = len(s)
mod = 1000000007
left = n * (n - 1) // 2 % mod
right = 0
out = 0
fact = 1
for i in range(n):
	out = (out + right * s[n - i - 1]) % mod
	out = (out + left * fact * s[n - i - 1]) % mod
	right = (right + (i + 1) * fact) % mod
	left = (left - (n - i - 1)) % mod
	fact = fact * 10 % mod
print(out)


import sys

def input():
	return sys.stdin.readline()[:-1]

def getInt():
	return int(input())

def getIntIter():
	return map(int, input().split())

def getIntList():
	return list(getIntIter())

def flush():
	sys.stdout.flush()
mod = 10 ** 9 + 7
powTen = [1]
for x in range(10 ** 5):
	powTen.append(powTen[-1] * 10 % mod)
pairs = []
for x in range(10 ** 5):
	pairs.append(x * (x + 1) // 2)
multi = [0]
for x in range(1, 10 ** 5):
	multi.append((x * powTen[x - 1] + multi[-1]) % mod)
num = input()
l = len(num)
ans = 0
for x in range(len(num)):
	p = l - 1 - x
	d = int(num[x])
	ans += powTen[p] * d * pairs[x]
	ans %= mod
	ans += multi[p] * d
print(ans)


import os
import sys
from io import BytesIO, IOBase

def contSum(n, p):
	a = n * (n + 1) % p
	a = a * pow(2, p - 2, p) % p
	return a

def main():
	s = input()
	digits = list()
	n = len(s)
	for i in range(n - 1, -1, -1):
		digits.append(int(s[i]))
	p = int(1000000000.0 + 7)
	C = [0] * n
	for i in range(n):
		C[i] = pow(10, i, p) * (i + 1) % p
	prefix = [0] * n
	prefix[0] = C[0]
	for i in range(1, n):
		prefix[i] = (prefix[i - 1] + C[i]) % p
	ans = 0
	for i in range(n):
		d = digits[i]
		right = contSum(n - i - 1, p) * pow(10, i, p) % p
		right = right * d % p
		if i == 0:
			left = 0
		else:
			left = prefix[i - 1] * d % p
		contribution = (right + left) % p
		ans = (ans + contribution) % p
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = lambda s: self.buffer.write(s.encode()) if self.writable else None

	def read(self):
		if self.buffer.tell():
			return self.buffer.read().decode('ascii')
		return os.read(self._fd, os.fstat(self._fd).st_size).decode('ascii')

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline().decode('ascii')

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

def print(*args, sep=' ', end='\n', file=sys.stdout, flush=False):
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(end)
	if flush:
		file.flush()
(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
sys.setrecursionlimit(10000)
main()


import sys
import math
from collections import defaultdict, deque
input = sys.stdin.readline

def inar():
	return [int(el) for el in input().split()]

def main():
	num = input().strip()
	n = len(num)
	mod = 10 ** 9 + 7
	prefix = [0]
	ans = 0
	for i in range(1, n + 1):
		prefix.append((i * pow(10, i - 1, mod) + prefix[-1]) % mod)
	for i in range(n):
		d = int(num[i])
		ans = (ans + i * (i + 1) // 2 * (d * pow(10, n - i - 1, mod)) % mod) % mod
		ans = (ans + d * prefix[n - i - 1] % mod) % mod
	print(ans)
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
vals = [int(k) for k in input()]
mod = 10 ** 9 + 7
n = len(vals)
temp = [1]
for s in range(1, n):
	temp.append(temp[-1] * 10 % mod)
sum1 = 0
for s in range(n - 1, 0, -1):
	sum1 += s * temp[s - 1]
	sum1 = sum1 % mod
ans = 0
sum2 = 0
t = 0
for s in range(n):
	ans += vals[s] * (sum1 + t * temp[n - 1 - s])
	if s < n - 1:
		sum1 -= (n - 1 - s) * temp[n - 2 - s]
		t += s + 1
		t = t % mod
	ans = ans % mod
	sum1 = sum1 % mod
	sum2 = sum2 % mod
print(ans)


s = input()
n = len(s)
number = int(s)
num = 0
num2 = 0
p = 1000000007
base = 1
ans = 0
base2 = 0
nums = []
for i in range(n):
	base2 += base
	base2 %= p
	nums.append(base2)
	num2 += base * (ord(s[n - 1 - i]) - ord('0'))
	num2 %= p
	base *= 10
	base %= p
	ans += num2 * (n - 1 - i)
	ans %= p
for i in range(n - 1):
	num *= 10
	num += ord(s[i]) - ord('0')
	num %= p
	ans += num * nums[n - 2 - i]
	ans %= p
print(ans % p)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def prod(a, mod=10 ** 9 + 7):
	ans = 1
	for each in a:
		ans = ans * each % mod
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if not True else 1):
	s = [int(k) for k in input()]
	n = len(s)
	mod = 10 ** 9 + 7
	tenpow = [1] * (n + 696)
	for i in range(1, n + 696):
		tenpow[i] = tenpow[i - 1] * 10 % mod
	tsum = 0
	tsums = [0]
	for i in range(n - 1):
		tsum = (tsum + s[i]) % mod
		tsums += [tsum]
	ans = 0
	for i in range(n - 1):
		v = (n - 1 - i) * (n - i) // 2
		tsum = tsums[n - 1 - i] * (i + 1)
		ans = (ans + tenpow[i] * (v * s[n - i - 1] + tsum)) % mod
	print(ans % mod)


num = input()
s = len(num)
dp = [[0 for j in range(s + 1)] for i in range(10)]
mdp = [[0 for j in range(s + 1)] for i in range(10)]
mod = int(10 ** 9 + 7)
for i in range(10):
	su = 0
	for j in range(s + 1):
		if j == 0:
			dp[i][j] = 0
			mdp[i][j] = i
		else:
			mdp[i][j] = mdp[i][j - 1] * 10 % mod
			su = mdp[i][j - 1] * j
			dp[i][j] = (su + dp[i][j - 1]) % mod
res = 0
mdp2 = [1 for i in range(s + 1)]
for i in range(1, s + 1):
	mdp2[i] = mdp2[i - 1] * 10 % mod
for i in range(s):
	x = int(num[i])
	res += dp[x][s - i - 1]
	res += x * mdp2[s - i - 1] % mod * i * (i + 1) // 2
	res = res % mod
print(res)


mod = 10 ** 9 + 7
s = list(map(int, list(input())))
n = len(s)
summ = sum(s[0:n - 1])
num = n * (n + 1) // 2
ans = 0
for i in range(1, n + 1):
	num -= n - i + 1
	ans += (i * summ + num * s[n - i]) * pow(10, i - 1, mod) % mod
	ans = ans % mod
	summ -= s[n - i - 1]
print(ans)


from sys import stdin
s = stdin.readline().strip()
n = len(s)
if n == 1:
	print(0)
	exit(0)
mod = 10 ** 9 + 7
pref = [0 for i in range(n)]
apref = [0 for i in range(n)]
asuf = [0 for i in range(n)]
suf = [0 for i in range(n)]
pref[0] = int(s[0])
apref[0] = int(s[0])
suf[0] = int(s[-1])
asuf[0] = int(s[-1])
for i in range(1, n):
	pref[i] = (pref[i - 1] * 10 + int(s[i])) % mod
	apref[i] = (apref[i - 1] + pref[i]) % mod
aux = 10
x = 0
for i in range(n - 2, -1, -1):
	suf[x + 1] = (suf[x] + int(s[i]) * aux) % mod
	asuf[x + 1] = (asuf[x] + suf[x + 1]) % mod
	x += 1
	aux = aux * 10 % mod
suf = suf[::-1]
asuf = asuf[::-1]
aux = 10
ans = 0
for i in range(n - 2, 0, -1):
	ans = (ans + apref[i - 1] * aux + suf[i + 1] * i) % mod
	aux = aux * 10 % mod
print((ans + apref[n - 2] + asuf[1]) % mod)


m = 1000000007
s = str(input())
n = len(s)
dp = [0 for i in range(n)]
i = n - 2
b = int(s[-1])
c = b
while i > -1:
	k = n - i - 1
	d = (k * pow(10, k + 1, m) - (k + 1) * pow(10, k, m) + 1) * pow(81, m - 2, m)
	dp[i] = (c + dp[i + 1] + int(s[i]) * d) % m
	b = (b + int(s[i]) * pow(10, k, m)) % m
	c = (c + b) % m
	i -= 1
print(dp[0])


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=300006, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] > k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater

class TrieNode:

	def __init__(self):
		self.children = [None] * 26
		self.isEndOfWord = False

class Trie:

	def __init__(self):
		self.root = self.getNode()

	def getNode(self):
		return TrieNode()

	def _charToIndex(self, ch):
		return ord(ch) - ord('a')

	def insert(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				pCrawl.children[index] = self.getNode()
			pCrawl = pCrawl.children[index]
		pCrawl.isEndOfWord = True

	def search(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				return False
			pCrawl = pCrawl.children[index]
		return pCrawl != None and pCrawl.isEndOfWord

class Node:

	def __init__(self, data):
		self.data = data
		self.count = 0
		self.left = None
		self.right = None

class BinaryTrie:

	def __init__(self):
		self.root = Node(0)

	def insert(self, pre_xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = pre_xor & 1 << i
			if val:
				if not self.temp.right:
					self.temp.right = Node(0)
				self.temp = self.temp.right
				self.temp.count += 1
			if not val:
				if not self.temp.left:
					self.temp.left = Node(0)
				self.temp = self.temp.left
				self.temp.count += 1
		self.temp.data = pre_xor

	def query(self, xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = xor & 1 << i
			if not val:
				if self.temp.left and self.temp.left.count > 0:
					self.temp = self.temp.left
				elif self.temp.right:
					self.temp = self.temp.right
			elif self.temp.right and self.temp.right.count > 0:
				self.temp = self.temp.right
			elif self.temp.left:
				self.temp = self.temp.left
			self.temp.count -= 1
		return xor ^ self.temp.data
n = input()
ans = 0
su = 0
for i in range(len(n) - 1, -1, -1):
	if i != len(n) - 1:
		su += (len(n) - i - 1) * pow(10, len(n) - i - 2, mod)
	su %= mod
	ans += pow(10, len(n) - i - 1, mod) * (i * (i + 1) // 2) * int(n[i])
	ans %= mod
	ans += su * int(n[i])
	ans %= mod
print(ans % mod)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(RL())

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)

def toord(c):
	return ord(c) - ord('a')

def lcm(a, b):
	return a * b // gcd(a, b)
mod = 10 ** 9 + 7
INF = float('inf')
from math import factorial, sqrt, ceil, floor, gcd
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	n = input()
	total = 0
	le = len(n)
	for i in range(1, le + 1):
		total = total + i % mod
	res = 0
	sm = 0
	rec = [0]
	for i in range(le):
		rec.append((pow(10, i, mod) * (i + 1) + rec[-1]) % mod)
	for i in range(le):
		now = int(n[i])
		(left, right) = (i, le - i - 1)
		res = res + sm * now * pow(10, right, mod) % mod
		sm += i + 1
		if now == 0:
			continue
		res = res + now * rec[right]
	print(res % mod)
main()


import math
teststring = '100500100500\n'
online = __file__ != '/home/jhli/py/675/Problem_C.py'
(true, false) = (True, False)
if True:

	def spitout():
		for c in teststring.splitlines():
			yield c
	_ito = spitout()
	if not online:

		def input():
			return next(_ito)

	def build_enum(*a):
		built = dict()
		for (i, c) in enumerate(a):
			built[c] = i
		return lambda x: built[x]
s = input()
l = len(s)
P = 10 ** 9 + 7

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a):
	(g, x, y) = egcd(a, P)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % P
powten = [1] * (l + 2)
pre = [0] * (l + 2)
suf = [0] * (l + 2)
for i in range(1, l + 2):
	powten[i] = powten[i - 1] * 10 % P
for i in range(1, l):
	pre[i] = pre[i - 1] * 10 % P + int(s[i - 1])
for i in range(l - 1, 0, -1):
	suf[i - 1] = (suf[i] + int(s[i]) * powten[l - i - 1]) % P
ans = 0
for i in range(l):
	ans = (ans + pre[i] * (powten[l - i] - 1) % P * modinv(9) % P) % P
for j in range(l):
	ans = (ans + (j + 1) * suf[j]) % P
print(str(ans))


mod = int(1000000000.0 + 7)
s = input()
ans = 0
cur = 0
p = 1
m = 0
for n in s[::-1]:
	m += 1
	n = int(n)
	ans += n * cur
	ans %= mod
	left = len(s) - m
	ans += n * p % mod * (1 + left) * left // 2
	ans %= mod
	cur += m * p
	cur %= mod
	p *= 10
	p %= mod
print(ans % mod)


def solve():
	n = input()
	n = n[::-1]
	MOD = 10 ** 9 + 7
	l = len(n)
	cnt = 0
	p = 1
	ans = 0
	for i in range(0, l):
		m = l - i - 1
		ans += cnt * (ord(n[i]) - 48)
		ans %= MOD
		ans += p * (m * (m + 1)) // 2 * (ord(n[i]) - 48)
		cnt = (i + 1) * p + cnt
		p *= 10
		cnt %= MOD
		p %= MOD
	print(ans)
	return

def main():
	t = 1
	for _ in range(t):
		solve()
main()


n = input()
dp = [0] * (len(n) + 1)
mod = 10 ** 9 + 7
for i in range(1, len(n) + 1):
	dp[i] = (dp[i - 1] + i * pow(10, i - 1, mod)) % mod
ans = 0
for i in range(len(n)):
	left = i * (i + 1) // 2
	left = left * int(n[i]) * pow(10, len(n) - i - 1, mod)
	right = int(n[i]) * dp[len(n) - i - 1] % mod
	ans += (left + right) % mod
print(ans % mod)


n = int(input())
A = list(str(n))
A.reverse()
A = [int(a) for a in A]
mod = 10 ** 9 + 7
m = len(A)
temp = 0
cum = [0] * m
for i in range(m):
	temp += A[i] * pow(10, i, mod)
	temp = temp % mod
	cum[i] = temp
cum = [0] + cum
maxn = 10 ** 5 + 50
ten = [0] * (maxn + 1)
ten[0] = 1
for i in range(1, maxn):
	ten[i] = ten[i - 1] * 10
	ten[i] %= mod
table = [0] * (maxn + 1)
table[0] = 1
for i in range(1, maxn):
	table[i] = table[i - 1] * 10 + 1
	table[i] %= mod
res = 0
s = 0
for l in range(m + 1):
	res += (cum[m] - cum[l]) * pow(ten[l], mod - 2, mod) * table[l - 1] + s
	res %= mod
	s += cum[l]
res %= mod
print(res)


from bisect import *
from collections import *
from random import *
from decimal import *
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def st():
	return input().rstrip('\n')

def lis():
	return list(map(int, input().split()))

def ma():
	return map(int, input().split())
p = 10 ** 9 + 7
s = st()
pre = [int(s[0])]
for i in range(1, len(s)):
	re = pre[-1] * 10
	re %= p
	re += int(s[i])
	re %= p
	pre.append(re)
suf = [int(s[-1])]
for i in range(len(s) - 1):
	re = int(s[len(s) - i - 2]) * int(pow(10, i + 1, p))
	re %= p
	re += suf[-1]
	re %= p
	suf.append(re)
sufarr = [suf[0]]
for i in range(1, len(s)):
	sufarr.append((sufarr[-1] + suf[i]) % p)
pre.pop()
suf.pop()
sufarr.pop()
n = len(pre)
inv = int(pow(9, p - 2, p))
res = sum(pre)
res %= p
res += sum(suf)
res %= p
for i in range(n - 1):
	gp = 10
	re = pow(10, n - i - 1, p) - 1
	gp = gp * re % p
	gp = gp * inv
	gp = gp % p
	ff = pre[i] * gp % p
	ff += sufarr[n - i - 2]
	res += ff
	res %= p
print(res)


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from bisect import *
from math import sqrt, pi
import math
from itertools import permutations
from copy import deepcopy

def main():
	a = list(map(int, input().strip()))
	n = len(a)
	mod = 1000000007
	d = [a[-1]]
	e = [1]
	for i in range(1, n + 1):
		e.append(e[-1] * 10 % mod)
	for i in range(n - 2, -1, -1):
		d.append((d[-1] + a[i] * e[n - i - 1] % mod) % mod)
	for i in range(1, n):
		d[i] = (d[i] + d[i - 1]) % mod
	ans = 0
	s = 0
	xx = pow(9, mod - 2, mod)
	for i in range(n):
		if i + 2 <= n:
			z = s * ((e[n - i] - 1) * xx) % mod
			ans = (ans + d[-(i + 2)] + z) % mod
		else:
			ans = (ans + s) % mod
		s = (s * 10 + a[i]) % mod
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys, math
input = sys.stdin.readline
mod = 10 ** 9 + 7
s = input().strip('\n')
n = len(s)
pow10 = [1]
for i in range(1, n + 1):
	pow10.append(pow10[i - 1] * 10 % mod)
prefix = [1]
for i in range(1, n):
	prefix.append((prefix[i - 1] + pow10[i] * (i + 1)) % mod)
s = s[::-1]
ans = 0
for i in range(n):
	if i > 0:
		ans += prefix[i - 1] * int(s[i])
		ans %= mod
	m = n - i
	ans += int(s[i]) * (pow10[i] * (m * (m - 1) // 2))
	ans %= mod
print(ans)


mod = 10 ** 9 + 7
n = input().strip()
tens = []
pre = [0]
for i in range(10 ** 5 + 1):
	tens.append((i + 1) * pow(10, i, mod))
	tens[i] %= mod
	if i > 0:
		pre.append(tens[i] + pre[-1])
	else:
		pre.append(tens[i])
	pre[i] %= mod
f = len(n)
ans = 0
for i in range(f):
	ans += i * (i + 1) // 2 * pow(10, f - i - 1, mod) * int(n[i])
	ans %= mod
	ans += int(n[i]) * pre[f - i - 1]
	ans %= mod
print(ans)


n = input()
m = 0
ans = 0
b = 0
l = len(n)
M = int(1000000000.0 + 7)
B = [1] * l
for i in range(1, l - 1):
	B[i] = B[i - 1] * 10 % M
for i in range(1, l):
	m += i
	b += int(n[i - 1])
	a = l - i
	ans += B[a - 1] * (a * b + m * int(n[i]))
print(ans % M)


M = 10 ** 9 + 7
s = input()
n = len(s)
a = [0] * n
val = [0] * (n + 1)
b = [0] * (n + 1)
p = [0] * (n + 1)
p[n - 1] = 1
cur = 1
for i in range(n - 1, -1, -1):
	if i < n - 1:
		p[i] = p[i + 1] * 10 % M
	a[i] = cur * int(s[i]) % M
	cur *= 10
	cur %= M
	val[i] = val[i + 1] + a[i]
	val[i] %= M
b[0] = int(s[0])
for i in range(1, n):
	b[i] = (b[i - 1] * 10 + int(s[i])) % M
for i in range(1, n):
	b[i] = (b[i - 1] + b[i]) % M
ans = 0
cur = 0
for i in range(1, n):
	l = i
	ans = (ans + l * val[i] + b[i - 1] * p[i]) % M
	a[i] = (a[i - 1] + a[i]) % M
print(ans)


mod = 10 ** 9 + 7
pow10 = [1]
for i in range(1, 200000):
	pow10 += [pow10[i - 1] * 10 % mod]
s = input()
n = len(s)
ans = 0
left = 0
right = 0
for i in range(n - 1):
	right += pow10[i] * (i + 1)
	right %= mod
leftnum = 0
rightnum = n - 1
sub = n - 1
for i in range(n):
	num = int(s[i])
	ans += num * right + num * left
	rightnum -= 1
	leftnum += 1
	right -= sub * pow10[sub - 1]
	left = leftnum * (leftnum + 1) // 2 * pow10[sub - 1]
	right %= mod
	left %= mod
	ans %= mod
	sub -= 1
print(ans % mod)


from sys import stdin

class Input:

	def __init__(self):
		self.it = iter(stdin.readlines())

	def line(self):
		return next(self.it).strip()

	def array(self, sep=' ', cast=int):
		return list(map(cast, self.line().split(sep=sep)))

def testcases(unknown=False):
	inpt = Input()

	def testcases_decorator(func):
		(cases,) = [0] if unknown else inpt.array()
		while unknown or cases > 0:
			try:
				func(inpt)
				cases -= 1
			except StopIteration:
				break
	return testcases_decorator
MOD = 1000000007
N = 100005
ten = [1]
for i in range(1, N):
	ten.append(ten[-1] * 10)
	ten[-1] %= MOD
s = [1]
for i in range(1, N):
	s.append(ten[i] * (i + 1))
	s[-1] %= MOD
for i in range(1, N):
	s[i] += s[i - 1]
	s[i] %= MOD

@testcases(unknown=True)
def solve(inpt):
	n = inpt.line()
	m = len(n)
	ans = 0
	for i in range(m):
		d = int(n[i])
		rg = m - 1 - i
		if rg:
			ans += d * s[rg - 1]
		k = i * (i + 1) // 2
		ans += d * k * ten[m - 1 - i] % MOD
		ans %= MOD
	print(ans)


from bisect import *
from collections import *
from math import *
from heapq import *
from typing import List
from itertools import *
from operator import *
from functools import *
import sys
n = input()
l = len(n)
mod = 10 ** 9 + 7
p10 = [1]
cof = [0]
for i in range(1, l):
	p10.append(p10[-1] * 10 % mod)
	cof.append(cof[-1] + p10[i - 1] * i % mod)
ans = 0
for i in range(l):
	ans = (ans + (cof[i] + (l - i) * (l - i - 1) // 2 * p10[i]) * int(n[l - 1 - i])) % mod
print(ans)


mod = 10 ** 9 + 7
s = list(map(int, input()))[::-1]
n = len(s)
if n == 1:
	print(0)
	exit()
po = [1]
for i in range(n):
	po.append(po[-1] * 10 % mod)
si = [0] * n
si[n - 1] = s[n - 1]
for i in range(n - 2, -1, -1):
	si[i] = si[i + 1] + s[i]
ans = 0
for k in range(n - 1):
	ans += (k + 1) * si[k + 1] * po[k]
	ans %= mod
for k in range(n - 1):
	ans += s[k] * ((n - 1 - k) * (n - 1 - k - 1) // 2 + (n - 1 - k)) * po[k]
	ans %= mod
print(ans)


def read_int():
	return int(input())
mod = 1000000007
s = input()
n = len(s)
ten = [1]
f = [0]
for i in range(n):
	ten.append(ten[-1] * 10 % mod)
	f.append((f[-1] + (i + 1) * ten[i]) % mod)
ans = 0
for i in range(n):
	c = int(s[i])
	L = i
	R = n - i - 1
	lsub = L * (L + 1) // 2
	lsum = lsub * c * ten[R] % mod
	rsum = f[R] * c % mod
	ans = (ans + lsum + rsum) % mod
print(ans)


import sys
import os
from math import sqrt, log, log2, log10, gcd, floor, pow, sin, cos, tan, pi, inf, factorial
from copy import copy, deepcopy
from sys import exit, stdin, stdout
from collections import Counter, defaultdict, deque
from itertools import permutations
import heapq
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = 1000000007
iinp = lambda : int(sys.stdin.readline())
inp = lambda : sys.stdin.readline().strip()
strl = lambda : list(inp().strip().split(' '))
intl = lambda : list(map(int, inp().split(' ')))
mint = lambda : map(int, inp().split())
flol = lambda : list(map(float, inp().split(' ')))
flush = lambda : stdout.flush()

def permute(nums):

	def fun(arr, nums, cur, v):
		if len(cur) == len(nums):
			arr.append(cur.copy())
		i = 0
		while i < len(nums):
			if v[i]:
				i += 1
				continue
			else:
				cur.append(nums[i])
				v[i] = 1
				fun(arr, nums, cur, v)
				cur.pop()
				v[i] = 0
				i += 1
		return arr
	res = []
	nums.sort()
	v = [0] * len(nums)
	return fun(res, nums, [], v)

def subsets(res, index, arr, cur):
	res.append(cur.copy())
	for i in range(index, len(arr)):
		cur.append(arr[i])
		subsets(res, i + 1, arr, cur)
		cur.pop()
	return res

def sieve(N):
	root = int(sqrt(N))
	primes = [1] * (N + 1)
	(primes[0], primes[1]) = (0, 0)
	for i in range(2, root + 1):
		if primes[i]:
			for j in range(i * i, N + 1, i):
				primes[j] = 0
	return primes

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	p = int(sqrt(n))
	for i in range(5, p + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def bs2(arr, l, r, x):
	if x < arr[0] or x > arr[len(arr) - 1]:
		return -1
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def bs(arr, l, r, x):
	if x < arr[0]:
		return -1
	if x > arr[len(arr) - 1]:
		return len(arr)
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] <= x:
			l = mid + 1
		elif arr[mid] > x:
			r = mid - 1
	pos = l
	while pos < len(arr) and arr[pos] <= x:
		pos += 1
	return pos

def solve():
	s = input()
	n = len(s)
	pre = [0] * n
	presum = [0] * n
	suf = [0] * n
	sufsum = [0] * n
	ten = [0] * n
	tensum = [0] * n
	presum[0] = pre[0] = int(s[0])
	sufsum[n - 1] = suf[n - 1] = int(s[n - 1])
	ten[0] = 1
	tensum[0] = 0
	for i in range(1, n):
		pre[i] = (pre[i - 1] * 10 % mod + int(s[i])) % mod
		presum[i] = (presum[i - 1] + pre[i]) % mod
	p = 10
	for i in range(n - 2, -1, -1):
		suf[i] = (int(s[i]) * p % mod + suf[i + 1]) % mod
		sufsum[i] = (sufsum[i + 1] + suf[i]) % mod
		p = p * 10 % mod
	for i in range(1, n):
		ten[i] = ten[i - 1] * 10 % mod
		tensum[i] = (tensum[i - 1] + ten[i]) % mod
	if n == 1:
		print(0)
		return
	if n == 2:
		print(int(s[0]) + int(s[1]))
		return
	ans = 0
	ans = (ans + sufsum[1]) % mod
	ans = (ans + presum[n - 2]) % mod
	for i in range(1, n - 1):
		temp = pre[i - 1] * tensum[n - i - 1] % mod
		temp = (temp + sufsum[i + 1]) % mod
		ans = (ans + temp) % mod
	print(ans % mod)
solve()


d = list(input())
n = len(d)
d = [0] + list(map(int, d)) + [0]
p = [0 for i in range(n + 2)]
s = [0 for i in range(n + 2)]
MOD = 1000000007
cur = 0
for i in range(1, n + 1):
	cur = (cur * 10 + d[i]) % MOD
	p[i] = cur
p10 = 1
cur = 0
for i in range(n, 0, -1):
	cur = (cur + d[i] * p10) % MOD
	p10 = p10 * 10 % MOD
	s[i] = cur
for i in range(n, 0, -1):
	s[i] = (s[i] + s[i + 1]) % MOD
for i in range(1, n + 1):
	p[i] = (p[i - 1] + p[i]) % MOD
p10 = 1
ans = 0
for i in range(n - 1, -1, -1):
	ans = (ans + p10 * p[i]) % MOD
	p10 = p10 * 10 % MOD
for i in range(2, n + 1):
	ans = (ans + s[i]) % MOD
print(ans)


arr = [int(x) for x in input()]
MOD = int(1000000000.0 + 7)
n = len(arr)
pow10 = [1]
for i in range(1, n + 1):
	pow10.append(pow10[-1] * 10 % MOD)
suffixes = [0]
for i in range(1, n + 1):
	suffixes.append((suffixes[-1] + i * pow10[i - 1]) % MOD)
prefixes = [0]
triangle = 1
for i in range(1, n + 1):
	prefixes.append(prefixes[-1] + triangle)
	triangle += 1
suffixes = suffixes[::-1]
ans = 0
for (i, x) in enumerate(arr):
	ans += suffixes[i + 1] * x
	ans += prefixes[i] * x * pow10[n - i - 1]
	ans %= MOD
print(ans % MOD)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	mod = 1000000007
	z1 = [1]
	z2 = [0]
	v = 0
	for i in range(100005):
		k = z1[-1]
		z1.append(k * 10 % mod)
		v += k * (i + 1) % mod
		z2.append(v % mod)
	for _ in range(1):
		s = rs()
		n = len(s)
		ans = 0
		for i in range(n):
			curr = ord(s[i]) - 48
			ind = i + 1
			leftsideofind = i
			rightsideofind = n - i - 1
			leftsidecontribution = curr * z1[rightsideofind] * (leftsideofind * (leftsideofind + 1) // 2 % mod)
			rightsidecontribution = curr * z2[rightsideofind] % mod
			ans += (leftsidecontribution + rightsidecontribution) % mod
		print(ans % mod)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


n = input()
mod = 10 ** 9 + 7
ans = 0
mul1 = 0
mul2 = 1
for i in range(len(n) - 1, -1, -1):
	ans += int(n[i]) * (mul1 + mul2 * i * (i + 1) // 2)
	ans %= mod
	mul1 += (len(n) - i) * mul2
	mul1 %= mod
	mul2 *= 10
	mul2 %= mod
print(ans)


M = 1000000007
s = input()
n = len(s)
val = [0, 1]
power = [1]
start = 1
for i in range(1, n):
	ap = (i + 1) * start * 10 % M
	val.append((ap + val[-1]) % M)
	power.append(start * 10 % M)
	start = start * 10 % M
ans = 0
for i in range(n):
	ans = (ans + power[n - 1 - i] * int(s[i]) * i * (i + 1) // 2 % M) % M
	ans = (ans + int(s[i]) * val[n - 1 - i] % M) % M
print(ans)


S = list(input())
S = [int(elem) for elem in S]
n = len(S)
mod = int(1000000000.0 + 7)
r = [0] * (n + 1)
for i in range(1, n + 1):
	if i == 1:
		r[n + 1 - i] = S[-i]
	else:
		r[n + 1 - i] = (r[n + 2 - i] + S[-i] * pow(10, i - 1, mod)) % mod
l = [0] * (n + 1)
for i in range(1, n + 1):
	l[i] = (l[i - 1] * 10 + S[i - 1]) % mod

def inv(X):
	return pow(X, mod - 2, mod)
inv9 = inv(9)
ans = sum((l[k] * (pow(10, n - k, mod) - 1) * inv9 for k in range(1, n + 1))) + sum(((i - 1) * r[i] for i in range(2, n + 1)))
ans %= mod
print(ans)


MOD = 10 ** 9 + 7
a = list(map(int, list(input())))
n = len(a)
pow10 = [1] * (n + 1)
pref = [1] + [0] * n
for i in range(1, n + 1):
	pow10[i] = 10 * pow10[i - 1]
	pow10[i] %= MOD
	pref[i] = (pref[i - 1] + pow10[i] * (i + 1) % MOD) % MOD
ret = 0
for i in range(n):
	ret += a[i] * pow10[n - i - 1] * (i * (i + 1) // 2)
	ret %= MOD
	if n - i - 2 >= 0:
		ret += a[i] * pref[n - i - 2]
		ret %= MOD
print(ret)


s = list(input())
n = len(s)
for i in range(n):
	s[i] = int(s[i])
ans = 0
mod = 10 ** 9 + 7
for i in range(n):
	tmp = 0
	tmp = s[i] * pow(9, mod - 2, mod) * (n - i - 1) * pow(10, n - i - 1, mod)
	tmp %= mod
	tmp -= s[i] * pow(81, mod - 2, mod) * (pow(10, n - i - 1, mod) - 1)
	tmp %= mod
	tmp += (i * (i - 1) // 2 + i) * s[i] * pow(10, n - i - 1, mod)
	tmp %= mod
	ans += tmp
	ans %= mod
print(ans)


M = 10 ** 9 + 7

def power(x, y):
	ans = 1
	while y > 0:
		if y % 2 == 1:
			ans = ans * x % M
		y = y // 2
		x = x * x % M
	return ans % M
n = input()
k = len(n)
i = k - 1
cnt = 0
ans = 0
prev = 0
while i > -1:
	cnt += 1
	rem = k - cnt
	now = rem * (rem + 1) % M
	u = now * power(2, M - 2) % M
	total = power(10, cnt - 1) * int(n[i]) % M
	som = total * u % M
	som = (som + prev * int(n[i]) % M) % M
	ans = (ans + som) % M
	prev = (prev + cnt * power(10, cnt - 1) % M) % M
	i -= 1
print(ans)


import sys
[n] = [int(i) for i in input().split()]
digits = [int(i) for i in str(n)]
digits.reverse()
l = len(digits)
mod = 10 ** 9 + 7
inv = 123456791
inv2 = 500000004
ans = 0

def exp(base, nn):
	if nn == 0:
		return 1
	elif nn == 1:
		return base
	elif nn % 2 == 0:
		a = exp(base, nn // 2)
		return a * a % mod
	else:
		a = exp(base, nn // 2)
		return a * a % mod * base % mod

def rhs(nn):
	i1 = (exp(10, nn) * (9 * nn - 1) + 1) % mod
	return i1 * inv % mod
for i in range(len(digits)):
	d = digits[i]
	rr = rhs(i) % mod
	ll = (l - i) * (l - i - 1) // 2 % mod
	ll = ll * exp(10, i) % mod
	ans += d * (rr + ll) % mod
	ans = ans % mod
print(ans)


import sys
from collections import deque
from math import ceil, sqrt, gcd, factorial
from bisect import bisect_right, bisect_left
mod = 1000000007
INF = 10 ** 18
NINF = -INF

def I():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def modi(x):
	return pow(x, mod - 2, mod)

def lcm(x, y):
	return x * y // gcd(x, y)

def write(l):
	for i in l:
		print(i, end=' ')
	print()
s = input()
ans = 0
n = len(s)
i = modi(9)
for x in range(n):
	sx = int(s[x])
	t = x * (x + 1) // 2 % mod
	ans = (ans + sx * pow(10, n - x - 1, mod) * t % mod) % mod
	f = n - x - 1
	t1 = f * pow(10, f, mod) % mod
	t2 = (pow(10, f, mod) - 1) % mod
	t2 = t2 * i % mod
	temp = (t1 - t2) % mod
	temp = temp * i % mod
	ans = (ans + temp * sx) % mod
print(ans)