#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long ul;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

typedef priority_queue<int> pq;
typedef priority_queue<int,vector<int>,greater<int>> pqg;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const ll mod=1e9+7;

int main() {
ios::sync_with_stdio(0);
cin.tie(0);

string s;
cin>>s;
ll ans=0;

for(int i=0; i<s.size(); i++){
	ll num=s[i]-'0';
	ll left=ll(i);
	ll right=ll(s.size())-ll(i)-1;

	ans=(ans+ (num*((left*(left+1))/2)*(ll(pow(10,right)))%mod) )%mod;
	ans=(ans+ num*((right*ll(pow(10,right)) - ((ll(pow(10,right))-1)/9))%mod)/9 )%mod;
}

cout<<ans<<endl;
return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long ul;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

typedef priority_queue<int> pq;
typedef priority_queue<int,vector<int>,greater<int>> pqg;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const ll mod=1e9+7;

int main() {
ios::sync_with_stdio(0);
cin.tie(0);

string s;
cin>>s;
ll ans=0;

for(int i=0; i<s.size(); i++){
	ll num=s[i]-'0';
	ll left=ll(i);
	ll right=ll(s.size())-ll(i)-1;

	ans=(ans+ (((left*(left+1))/2)*(num*ll(pow(10,right)))%mod) )%mod;
	ans=(ans+ num*(right*ll(pow(10,right)) - ((ll(pow(10,right))-1)/9))/9 )%mod;
}

cout<<ans<<endl;
return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long ul;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

typedef priority_queue<int> pq;
typedef priority_queue<int,vector<int>,greater<int>> pqg;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const ll mod=1e9+7;

int main() {
ios::sync_with_stdio(0);
cin.tie(0);

string s;
cin>>s;
ll ans=0;

for(ll j=0; j<ll(s.size()); j++){
	ll num=s[j]-'0';
	ll left=j;
	ll right=s.size()-j-1;

	//have to remove at leat one
	for(ll i=1; i<=left; i++){ // i is how many we remove
		ans=(ans+ ((left-i+1)*(num*ll(pow(10,right)))%mod) )%mod;
	}
	for(ll i=1; i<=right; i++){ //i is how many we remove
		ans=(ans+ ((right-i+1)*(num*ll(pow(10,right-i)))%mod) )%mod;
	}
}

cout<<ans<<endl;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main()
{
    string s;
    cin>>s;
    ll n=s.size();
    ll pow[n+1];
    ll suffix[n+1];
     pow[0]=1;
    for(int i=1;i<n+1;i++)
    {
         pow[i]=((pow[i-1])%mod*10)%mod;
    }
    ll cum[n+1];
   cum[0]=0;
   for(int i=1;i<=n;i++){
       cum[i]=(i*pow[i-1])%mod;
   }
   for(int i=2;i<=n;i++){
       cum[i]=(cum[i]+cum[i-1])%mod;
   }

    ll ans=0;
    for(int i=0;i<n;i++)
    {
        // ll check=(s[i]-'0')%mod;
        // ll a=suffix[n-i-1]%mod;
        // ll a1=(a*check)%mod;
        // ans=(ans%mod + a1%mod)%mod;
        // ll b=pow[i]%mod;
        // ll a2=(check*b)%mod;
        // ans=(ans%mod + a2%mod)%mod;
        int x = s[i]-'0';
       ll left = (i*(i+1))/2;
       ans=(ans+(x*((power[n-i-1]%mod)*(left%mod)))%mod)%mod;
       ll right = cum[n-i-1];
       ans=(ans+((x%mod)*(right%mod))%mod)%mod;
    }

    cout<<ans<<"\n";
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main()
{
    string s;
    cin>>s;
    ll n=s.size();
    ll pow[n+1];
    ll suffix[n+1];
     pow[0]=1;
    for(int i=1;i<n+1;i++)
    {
        ll mult=pow[i-1]%mod;
        ll ans=(10*mult)%mod;
        pow[i]=ans;
    }
    ll cum[n+1];
   cum[0]=0;
   for(int i=1;i<=n;i++){
       cum[i]=(i*pow[i-1])%mod;
   }
   for(int i=2;i<=n;i++){
       cum[i]=(cum[i]%mod +cum[i-1] %mod)%mod;
   }

    ll ans=0;
    for(int i=0;i<n;i++)
    {
        // ll check=s[i]-'0';
        // check=check%mod;
        // ll a=suffix[n-i-1]%mod;
        // ll a1=(a%mod *check%mod)%mod;
        // ans=(ans + a1%mod)%mod;
        // ll total=(i*(i+1))/2;
        // ll b=(((total)%mod)*pow[n-i-1]%mod)%mod;
        // ll a2=(check%mod * b%mod )%mod;
        // ans=(ans + a2%mod)%mod;

    int x = s[i]-'0';
       ll left = (((i%mod *(i+1)%mod))%mod)/2;
       ans=(ans+(x*((pow[n-i-1]%mod)*(left%mod)))%mod)%mod;
       ll right = cum[n-i-1]%mod;
       ans=(ans+((x%mod)*(right%mod))%mod)%mod;
    }

    cout<<ans%mod<<"\n";
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main()
{
    string s;
    cin>>s;
    ll n=s.size();
    ll pow[n+1];
    ll suffix[n+1];
     pow[0]=1;
    for(int i=1;i<n+1;i++)
    {
        ll mult=pow[i-1]%mod;
        ll ans=(10*mult)%mod;
        pow[i]=ans;
    }
    suffix[0]=0;
    for(int i=1;i<n+1;i++)
    {
        ll mult=pow[i-1]%mod;
        mult=(i*mult)%mod;
        ll ans=(mult+suffix[i-1])%mod;
        suffix[i]=ans;
    }

    ll ans=0;
    for(int i=0;i<n;i++)
    {
        // ll check=s[i]-'0';
        // check=check%mod;
        // ll a=suffix[n-i-1]%mod;
        // ll a1=(a%mod *check%mod)%mod;
        // ans=(ans + a1%mod)%mod;
        // ll total=(i*(i+1))/2;
        // ll b=(((total)%mod)*pow[n-i-1]%mod)%mod;
        // ll a2=(check%mod * b%mod )%mod;
        // ans=(ans + a2%mod)%mod;

    int x = s[i]-'0';
       ll left = (((i%mod *(i+1)%mod))%mod)/2;
       ans=(ans+(x*((pow[n-i-1]%mod)*(left%mod)))%mod)%mod;
       ll right = suffix[n-i-1];
       ans=(ans+((x%mod)*(right%mod))%mod)%mod;
    }

    cout<<ans<<"\n";
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main()
{
    string s;
    cin>>s;
    ll n=s.size();
    ll pow[n+1];
    ll suffix[n+1];
     pow[0]=1;
    for(int i=1;i<n+1;i++)
    {
        ll mult=pow[i-1]%mod;
        ll ans=(10*mult)%mod;
        pow[i]=ans;
    }
    ll cum[n+1];
   cum[0]=0;
   for(int i=1;i<=n;i++){
       cum[i]=(i*pow[i-1])%mod;
   }
   for(int i=2;i<=n;i++){
       cum[i]=(cum[i]+cum[i-1])%mod;
   }

    ll ans=0;
    for(int i=0;i<n;i++)
    {
        // ll check=s[i]-'0';
        // check=check%mod;
        // ll a=suffix[n-i-1]%mod;
        // ll a1=(a%mod *check%mod)%mod;
        // ans=(ans + a1%mod)%mod;
        // ll total=(i*(i+1))/2;
        // ll b=(((total)%mod)*pow[n-i-1]%mod)%mod;
        // ll a2=(check%mod * b%mod )%mod;
        // ans=(ans + a2%mod)%mod;

    int x = s[i]-'0';
       ll left = (((i%mod *(i+1)%mod))%mod)/2;
       ans=(ans+(x*((pow[n-i-1]%mod)*(left%mod)))%mod)%mod;
       ll right = cum[n-i-1];
       ans=(ans+((x%mod)*(right%mod))%mod)%mod;
    }

    cout<<ans<<"\n";
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main()
{
    string s;
    cin>>s;
    ll n=s.size();
    ll pow[n+1];
    ll suffix[n+1];
     pow[0]=1;
    for(int i=1;i<n+1;i++)
    {
        ll mult=pow[i-1]%mod;
        ll ans=(10*mult)%mod;
        pow[i]=ans;
    }
    suffix[0]=0;
    for(int i=1;i<n+1;i++)
    {
        ll mult=pow[i-1]%mod;
        mult=(i*mult)%mod;
        ll ans=(mult+suffix[i-1])%mod;
        suffix[i]=ans;
    }

    ll ans=0;
    for(int i=0;i<n;i++)
    {
        // ll check=s[i]-'0';
        // check=check%mod;
        // ll a=suffix[n-i-1]%mod;
        // ll a1=(a%mod *check%mod)%mod;
        // ans=(ans + a1%mod)%mod;
        // ll total=(i*(i+1))/2;
        // ll b=(((total)%mod)*pow[n-i-1]%mod)%mod;
        // ll a2=(check%mod * b%mod )%mod;
        // ans=(ans + a2%mod)%mod;

    int x = s[i]-'0';
       ll left = (i*(i+1))/2;
       ans=(ans+(x*((pow[n-i-1]%mod)*(left%mod)))%mod)%mod;
       ll right = suffix[n-i-1];
       ans=(ans+((x%mod)*(right%mod))%mod)%mod;
    }

    cout<<ans<<"\n";
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main()
{
    string s;
    cin>>s;
    ll n=s.size();
    ll pow[n+1];
    ll suffix[n+1];
     pow[0]=1;
    for(int i=1;i<n+1;i++)
    {
        ll mult=pow[i-1]%mod;
        ll ans=(10*mult)%mod;
        pow[i]=ans;
    }
    suffix[0]=0;
    for(int i=1;i<n+1;i++)
    {
        ll mult=pow[i-1]%mod;
        mult=(i*mult)%mod;
        ll ans=(mult+suffix[i-1])%mod;
        suffix[i]=ans;
    }

    for(int i=0;i<n+1;i++)
    cout<<pow[i]<<" ";
    cout<<"\n";

     for(int i=0;i<n+1;i++)
    cout<<suffix[i]<<" ";
    cout<<"\n";

    ll ans=0;
    for(int i=0;i<n;i++)
    {
        ll check=s[i]-'0';
        check=check%mod;
        ll a=suffix[n-i-1]%mod;
        ll a1=(a%mod *check%mod)%mod;
        ans=(ans + a1%mod)%mod;
        ll total=(i*(i+1))/2;
        ll b=(((total)%mod)*pow[n-i-1]%mod)%mod;
        ll a2=(check%mod * b%mod )%mod;
        ans=(ans + a2%mod)%mod;

    }

    cout<<ans<<"\n";
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main()
{
    string s;
    cin>>s;
    ll n=s.size();
    ll pow[n+1];
    ll suffix[n+1];
     pow[0]=1;
    for(int i=1;i<n+1;i++)
    {
         pow[i]=((pow[i-1])%mod*10)%mod;
    }
    ll cum[n+1];
   cum[0]=0;
   for(int i=1;i<=n;i++){
       cum[i]=(i*pow[i-1])%mod;
   }
   for(int i=2;i<=n;i++){
       cum[i]=(cum[i]+cum[i-1])%mod;
   }

    ll ans=0;
    for(int i=0;i<n;i++)
    {
        // ll check=(s[i]-'0')%mod;
        // ll a=suffix[n-i-1]%mod;
        // ll a1=(a*check)%mod;
        // ans=(ans%mod + a1%mod)%mod;
        // ll b=pow[i]%mod;
        // ll a2=(check*b)%mod;
        // ans=(ans%mod + a2%mod)%mod;
        int x = s[i]-'0';
       ll left = (i*(i+1))/2;
       ans=(ans+(x*((pow[n-i-1]%mod)*(left%mod)))%mod)%mod;
       ll right = cum[n-i-1];
       ans=(ans+((x%mod)*(right%mod))%mod)%mod;
    }

    cout<<ans<<"\n";
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main()
{
    string s;
    cin>>s;
    ll n=s.size();
    ll pow[n+1];
    ll suffix[n+1];
     pow[0]=1;
    for(ll i=1;i<n+1;i++)
    {
        ll mult=pow[i-1]%mod;
        ll ans=(10*mult)%mod;
        pow[i]=ans;
    }
    suffix[0]=0;
    for(ll i=1;i<n+1;i++)
    {
        ll mult=pow[i-1]%mod;
        mult=(i*mult)%mod;
        ll ans=(mult+suffix[i-1])%mod;
        suffix[i]=ans;
    }

    ll ans=0;
    for(ll i=0;i<n;i++)
    {
        ll check=s[i]-'0';
        check=check%mod;
        ll a=suffix[n-i-1]%mod;
        ll a1=(a%mod *check%mod)%mod;
        ans=(ans + a1%mod)%mod;
        ll total=(i*(i+1))/2;
        ll b=(((total)%mod)*pow[n-i-1]%mod)%mod;
        ll a2=(check%mod * b%mod )%mod;
        ans=(ans + a2%mod)%mod;

    }

    cout<<ans<<"\n";
}


#include<bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using boost::multiprecision::cpp_int;
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

// #define OST tree < pair <int, int>,  null_type ,  less<pair <int, int>> ,  rb_tree_tag ,  tree_order_statistics_node_update >

#define ll long long
#define pb push_back
#define ull unsigned long long
#define ff first
#define ss second
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define test int t;cin>>t;while(t--)
#define mp make_pair
#define modInv(n) po(n,mod-2)%mod
#define ncr(n,r) (((fact[n]*modInv(fact[r]))%mod)*modInv(fact[n-r]))%mod
#define setbits(y) __builtin_popcountll(y)
#define mod 1000000007

ll po(ll a,ll b){
    if(b==0) return 1;
    ll ans=1;
    if(b%2==0){
        ans = po(a,b/2)%mod;
        ans=(ans%mod * ans%mod)%mod;
    }
    else{
        ans = po(a,(b-1)/2)%mod;
        ans = (ans%mod * ans%mod * a)%mod;
    }
    return ans%mod;
}

/////////////////////////////////////////
// Separate string at a particular points
vector <string> tokens;
void separate_string(string line){
    stringstream check1(line);
    string lav;
    while(getline(check1, lav, '*'))
    {
        tokens.push_back(lav);
    }
}
/////////////////////////////////////////

////////////////////////////////
// All divisors in (sqrt(n));

vector<ll>divisors;
void get_Divisors(ll n){
    for(int i=1;i<=sqrt(n);i++){
        if(n%i==0){
           if(n/i==i){
               divisors.pb(n/i);
           }else{
               divisors.pb(i);
               divisors.pb(n/i);
           }
        }
    }
}

bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}

////////////////////////////////
////////////////////////////////

// string to int :::::::::::::::::::(stoi());
// string to long long :::::::::::::::::::  (stoll())
// int or long long to string  ::::::::::::::::::: to_string(num);
// gives part before . :::::::::::::::::::  trunc(num);
// rounding numbers :::::::::::::::::::  round(num);
// provides fixed number after decimal places  ::::::::::: cout<<fixed<<setprecision(5)<<p;
// Fermat little theorem pow(a,m-1) congruent to  1(mod m) if a and m are coprime ;
// [a/b] === [a+b-1/b];

///*** Multimap:- ///***
///*** multimap<int,int>mp2  ***///
/// It allows same repeated values as key
///*** mp2.insert(pair <ll, ll> (x, y)) ///***

// nth catalan number 1/(n+1)(2n C n);

//Lower Bound and Upper Bound //
// lower bound of x returns an iterator pointing to the first occurance of element(num) s.t. num>=x else returns v.end();
// Upper bound of x returns an iterator pointing to the first occurance of element(num) s.t. num>x else returns v.end();

//Ordered Set //
//find_by_order(k): It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time.
//order_of_key(k) : It returns to the number of items that are strictly smaller than our item k in O(logn) time.

void solve(){
   string s;
   cin>>s;
   ll n = s.size();
   ll power[n+1];
   ll i,j;
   power[0]=1;
   for(i=1;i<=n;i++){
       power[i]=((power[i-1])%mod*10)%mod;
   }
   ll cum[n+1];
   cum[0]=0;
   for(i=1;i<=n;i++){
       cum[i]=(i*power[i-1])%mod;
   }
   for(i=2;i<=n;i++){
       cum[i]=(cum[i]+cum[i-1])%mod;
   }

   ll ans=0;
   for(i=0;i<n;i++){
       int x = s[i]-'0';
       ll left = (i*(i+1))/2;
       ans=(ans+(x*((power[n-i-1]%mod)*(left%mod)))%mod)%mod;
       ll right = cum[n-i-1];
       ans=(ans+((x%mod)*(right%mod))%mod)%mod;
   }
   cout<<ans;
}

int main(){
    IOS
    // test{
    //     solve(); cout<<"\n";
    // }
    solve();
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main()
{
    string s;
    cin>>s;
    ll n=s.size();
    ll pow[n+1];
    ll suffix[n+1];
     pow[0]=1;
    for(int i=1;i<n+1;i++)
    {
        ll mult=pow[i-1]%mod;
        ll ans=(10*mult)%mod;
        pow[i]=ans;
    }
    ll cum[n+1];
   cum[0]=0;
   for(int i=1;i<=n;i++){
       cum[i]=(i*pow[i-1])%mod;
   }
   for(int i=2;i<=n;i++){
       cum[i]=(cum[i]%mod +cum[i-1] %mod)%mod;
   }

    ll ans=0;
    for(int i=0;i<n;i++)
    {
        // ll check=s[i]-'0';
        // check=check%mod;
        // ll a=suffix[n-i-1]%mod;
        // ll a1=(a%mod *check%mod)%mod;
        // ans=(ans + a1%mod)%mod;
        // ll total=(i*(i+1))/2;
        // ll b=(((total)%mod)*pow[n-i-1]%mod)%mod;
        // ll a2=(check%mod * b%mod )%mod;
        // ans=(ans + a2%mod)%mod;

    int x = (s[i]-'0')%mod;
       ll left = (((i%mod *(i+1)%mod))%mod)/2;
       ans=(ans+(x*((pow[n-i-1]%mod)*(left%mod)))%mod)%mod;
       ll right = cum[n-i-1]%mod;
       ans=(ans+((x%mod)*(right%mod))%mod)%mod;
    }

    cout<<ans%mod<<"\n";
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main()
{
    string s;
    cin>>s;
    ll n=s.size();
    ll pow[n+1];
    ll suffix[n+1];
     pow[0]=1;
    for(int i=1;i<=n;i++)
    {
         pow[i]=((pow[i-1])%mod*10)%mod;
    }
    ll cum[n+1];
   cum[0]=0;
   for(int i=1;i<=n;i++){
       cum[i]=(i*pow[i-1])%mod;
   }
   for(int i=2;i<=n;i++){
       cum[i]=(cum[i]+cum[i-1])%mod;
   }

    ll ans=0;
    for(int i=0;i<n;i++)
    {
        // ll check=(s[i]-'0')%mod;
        // ll a=suffix[n-i-1]%mod;
        // ll a1=(a*check)%mod;
        // ans=(ans%mod + a1%mod)%mod;
        // ll b=pow[i]%mod;
        // ll a2=(check*b)%mod;
        // ans=(ans%mod + a2%mod)%mod;
        int x = s[i]-'0';
       ll left = (i*(i+1))/2;
       ans=(ans+(x*((pow[n-i-1]%mod)*(left%mod)))%mod)%mod;
       ll right = cum[n-i-1];
       ans=(ans+((x%mod)*(right%mod))%mod)%mod;
    }

    cout<<ans<<"\n";
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main()
{
    string s;
    cin>>s;
    ll n=s.size();
    ll pow[n+1];
    ll suffix[n+1];
     pow[0]=1;
    for(ll i=1;i<=n;i++)
    {
         pow[i]=((pow[i-1])%mod*10)%mod;
    }
    ll cum[n+1];
   cum[0]=0;
   for(ll i=1;i<=n;i++){
       cum[i]=(i*pow[i-1])%mod;
   }
   for(ll i=2;i<=n;i++){
       cum[i]=(cum[i]+cum[i-1])%mod;
   }

    ll ans=0;
    for(ll i=0;i<n;i++)
    {
        // ll check=(s[i]-'0')%mod;
        // ll a=suffix[n-i-1]%mod;
        // ll a1=(a*check)%mod;
        // ans=(ans%mod + a1%mod)%mod;
        // ll b=pow[i]%mod;
        // ll a2=(check*b)%mod;
        // ans=(ans%mod + a2%mod)%mod;
        int x = s[i]-'0';
       ll left = (i*(i+1))/2;
       ans=(ans+(x*((pow[n-i-1]%mod)*(left%mod)))%mod)%mod;
       ll right = cum[n-i-1];
       ans=(ans+((x%mod)*(right%mod))%mod)%mod;
    }

    cout<<ans<<"\n";
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main()
{
    string s;
    cin>>s;
    ll n=s.size();
    ll pow[n+1];
    ll suffix[n+1];
     pow[0]=1;
    for(int i=1;i<n+1;i++)
    {
        ll mult=pow[i-1]%mod;
        ll ans=(10*mult)%mod;
        pow[i]=ans;
    }
    suffix[0]=0;
    for(int i=1;i<n+1;i++)
    {
        ll mult=pow[i-1]%mod;
        mult=(i*mult)%mod;
        ll ans=(mult+suffix[i-1])%mod;
        suffix[i]=ans;
    }

    ll ans=0;
    for(int i=0;i<n;i++)
    {
        ll check=s[i]-'0';
        check=check%mod;
        ll a=suffix[n-i-1]%mod;
        ll a1=(a%mod *check%mod)%mod;
        ans=(ans + a1%mod)%mod;
        ll total=(i*(i+1))/2;
        ll b=(((total)%mod)*pow[n-i-1]%mod)%mod;
        ll a2=(check%mod * b%mod )%mod;
        ans=(ans + a2%mod)%mod;

    }

    cout<<ans<<"\n";
}


#include<bits/stdc++.h>
using namespace std;

typedef vector <int> vi;
typedef pair< int ,int > pii;

#define endl "\n"
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define ll long long
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define OJ \
	freopen("input.txt", "r", stdin); \
	freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int mul(int n, int m){
    return (( n * 1ll * m) % MOD);
}

int add(int n, int m){
	return 1ll * (n + m) % MOD;
}

int subtract(int n, int m){
	return 1ll * ((n - m) % MOD + MOD) % MOD;
}

int fastpower(int n, int m){
    //binary_power
    int res = 1;
    for(; m > 0; m /= 2){
        if(m & 1)
            res = mul(res, n);
        n = mul(n, n);
    }

    return res;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	string n;
	cin >> n;
	int len = n.length();
	ll sum = 0l;
	vector<int> pow10(len+10);
	pow10[0] = 1;
	for(int i=1; i<len+10; i++)
		pow10[i] = mul(pow10[i-1], 10);

	vector<int> right(len+10);
	right[0] = 0;
	for(int i=1; i<len+10; i++){
		right[i] = mul(i, pow10[i-1]);
	}

	for(int i=1; i<len+10; i++){
		right[i] = add(right[i-1], right[i]);
	}

	// for(int i=0; i<len; i++)
	// 	cout << right[i] << " ";

	// cout << endl;
	for(int i=0; i<len; i++){
		int d = n[i] - '0';
		sum = add(mul(d, right[len-i-1]), sum);
		int pre = mul(i,  (i + 1)) / 2;
		sum = add(sum, mul(d, mul(pre, pow10[len - i - 1])));
	}

	cout << sum << endl;
}


#include<bits/stdc++.h>
using namespace std;

typedef vector <int> vi;
typedef pair< int ,int > pii;

#define endl "\n"
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define ll long long
#define int long long int
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define OJ \
	freopen("input.txt", "r", stdin); \
	freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int mul(int n, int m){
    return (( n * 1ll * m) % MOD);
}

int add(int n, int m){
	return 1ll * (n + m) % MOD;
}

int subtract(int n, int m){
	return 1ll * ((n - m) % MOD + MOD) % MOD;
}

int fastpower(int n, int m){
    //binary_power
    int res = 1;
    for(; m > 0; m /= 2){
        if(m & 1)
            res = mul(res, n);
        n = mul(n, n);
    }

    return res;
}

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	string n;
	cin >> n;
	int len = n.length();
	int sum = 0;
	vector<int> pow10(len+10);
	pow10[0] = 1;
	for(int i=1; i<len+10; i++)
		pow10[i] = mul(pow10[i-1], 10);

	vector<int> right(len+10);
	right[0] = 0;
	for(int i=1; i<len+10; i++){
		right[i] = mul(i, pow10[i-1]);
	}

	for(int i=1; i<len+10; i++){
		right[i] = add(right[i-1], right[i]);
	}

	// for(int i=0; i<len; i++)
	// 	cout << right[i] << " ";

	// cout << endl;
	for(int i=0; i<len; i++){
		int d = n[i] - '0';
		sum = add(mul(d, right[len-i-1]), sum);
		int pre = i * (i + 1) / 2;
		sum = add(sum, mul(d, mul(pre, pow10[len - i - 1])));
	}

	cout << sum << endl;
}


#include<bits/stdc++.h>
using namespace std;

typedef vector <int> vi;
typedef pair< int ,int > pii;

#define endl "\n"
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define ll long long
#define int long long int
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define OJ \
	freopen("input.txt", "r", stdin); \
	freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int mul(int n, int m){
    return (( n * 1ll * m) % MOD);
}

int add(int n, int m){
	return 1ll * (n + m) % MOD;
}

int subtract(int n, int m){
	return 1ll * ((n - m) % MOD + MOD) % MOD;
}

int fastpower(int n, int m){
    //binary_power
    int res = 1;
    for(; m > 0; m /= 2){
        if(m & 1)
            res = mul(res, n);
        n = mul(n, n);
    }

    return res;
}

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	string n;
	cin >> n;
	int len = n.length();
	ll sum = 0l;
	vector<int> pow10(len+10);
	pow10[0] = 1;
	for(int i=1; i<len+10; i++)
		pow10[i] = mul(pow10[i-1], 10);

	vector<int> right(len+10);
	right[0] = 0;
	for(int i=1; i<len+10; i++){
		right[i] = mul(i, pow10[i-1]);
	}

	for(int i=1; i<len+10; i++){
		right[i] = add(right[i-1], right[i]);
	}

	// for(int i=0; i<len; i++)
	// 	cout << right[i] << " ";

	// cout << endl;
	for(int i=0; i<len; i++){
		int d = n[i] - '0';
		sum = add(mul(d, right[len-i-1]), sum);
		int pre = mul(i,  (i + 1)) / 2;
		sum = add(sum, mul(d, mul(pre, pow10[len - i - 1])));
	}

	cout << sum << endl;
}


#include<bits/stdc++.h>
using namespace std;

typedef vector <int> vi;
typedef pair< int ,int > pii;

#define endl "\n"
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define ll long long
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define OJ \
	freopen("input.txt", "r", stdin); \
	freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int mul(int n, int m){
    return (( n * 1ll * m) % MOD);
}

int add(int n, int m){
	return 1ll * (n + m) % MOD;
}

int subtract(int n, int m){
	return 1ll * ((n - m) % MOD + MOD) % MOD;
}

int fastpower(int n, int m){
    //binary_power
    int res = 1;
    for(; m > 0; m /= 2){
        if(m & 1)
            res = mul(res, n);
        n = mul(n, n);
    }

    return res;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	string n;
	cin >> n;
	int len = n.length();
	ll sum = 0l;
	vector<int> pow10(len+10);
	pow10[0] = 1;
	for(int i=1; i<len+10; i++)
		pow10[i] = mul(pow10[i-1], 10);

	vector<int> right(len+10);
	right[0] = 0;
	for(int i=1; i<len+10; i++){
		right[i] = mul(i, pow10[i-1]);
	}

	for(int i=1; i<len+10; i++){
		right[i] = add(right[i-1], right[i]);
	}

	// for(int i=0; i<len; i++)
	// 	cout << right[i] << " ";

	// cout << endl;
	for(int i=0; i<len; i++){
		int d = n[i] - '0';
		sum = add(mul(d, right[len-i-1]), sum);
		int pre = i * (i + 1) / 2;
		sum = add(sum, mul(d, mul(pre, pow10[len - i - 1])));
	}

	cout << sum << endl;
}


#include<bits/stdc++.h>
using namespace std;

typedef vector <int> vi;
typedef pair< int ,int > pii;

#define endl "\n"
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define ll long long
#define int long long int
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define OJ \
	freopen("input.txt", "r", stdin); \
	freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int mul(int n, int m){
    return (( n * 1ll * m) % MOD);
}

int add(int n, int m){
	return 1ll * (n + m) % MOD;
}

int subtract(int n, int m){
	return 1ll * ((n - m) % MOD + MOD) % MOD;
}

int fastpower(int n, int m){
    //binary_power
    int res = 1;
    for(; m > 0; m /= 2){
        if(m & 1)
            res = mul(res, n);
        n = mul(n, n);
    }

    return res;
}

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	string n;
	cin >> n;
	int len = n.length();
	int sum = 0;
	vector<int> pow10(len+10);
	pow10[0] = 1;
	for(int i=1; i<len+10; i++)
		pow10[i] = mul(pow10[i-1], 10);

	vector<int> right(len+10);
	right[0] = 0;
	for(int i=1; i<len+10; i++){
		right[i] = mul(i, pow10[i-1]);
	}

	for(int i=1; i<len+10; i++){
		right[i] = add(right[i-1], right[i]);
	}

	// for(int i=0; i<len; i++)
	// 	cout << right[i] << " ";

	// cout << endl;
	for(int i=0; i<len; i++){
		int d = n[i] - '0';
		sum = add(mul(d, right[len-i-1]), sum);
		int pre = mul(i,  (i + 1)) / 2;
		sum = add(sum, mul(d, mul(pre, pow10[len - i - 1])));
	}

	cout << sum << endl;
}


#include <vector>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#define ll long long
#define chushi(a, b) memset(a, b, sizeof(a))
const double eps = 1e-8;
const ll INF = 1e9;
const ll mod = 1e9 + 7;
const int maxn = 1e5+10;
using namespace std;

ll p[maxn];
ll t[maxn];

int main(){

	p[0] = 1;
	for(int i = 1; i <= 1e5; i++) p[i] = (p[i-1] * 10) % mod;
	for(int i = 1; i <= 1e5; i++) t[i] = (p[i-2] * (i-1)) % mod;
	for(int i = 1; i <= 1e5; i++) t[i] = (t[i] + t[i-1]) % mod;

	string s;
	cin >> s;
	int n = s.size();
	reverse(s.begin(), s.end());
	ll sum = 0, res = 0;
	for(int i = 0; i < n; i++){
		ll num = (n - i) * (n - i - 1) / 2 % mod;
		res = (res + ((s[i] - '0') * num * p[i] % mod)) % mod;
		res = (res + (s[i] - '0') * t[i+1]) % mod;
	}
	cout << res << endl;
	return 0;
}


#include <vector>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#define ll long long
#define chushi(a, b) memset(a, b, sizeof(a))
const double eps = 1e-8;
const ll INF = 1e9;
const ll mod = 1e9 + 7;
const int maxn = 1e5+10;
using namespace std;

ll p[maxn] = {0};
ll t[maxn] = {0};

int main(){

	p[0] = 1;
	for(int i = 1; i <= 1e5+5; i++) p[i] = (p[i-1] * 10) % mod;
	for(int i = 2; i <= 1e5+5; i++) t[i] = (p[i-2] * (i-1)) % mod;
	for(int i = 1; i <= 1e5+5; i++) t[i] = (t[i] + t[i-1]) % mod;

	string s;
	cin >> s;
	ll n = s.size();
	reverse(s.begin(), s.end());
	ll sum = 0, res = 0;
	for(ll i = 0; i < n; i++){
		ll num = (n - i) * (n - i - 1) / 2 % mod;
		res = (res + ((s[i] - '0') * num % mod * p[i] % mod)) % mod;
		res = (res + (s[i] - '0') * t[i+1]) % mod;
	}
	cout << res << endl;
	return 0;
}


#include <vector>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#define ll long long
#define chushi(a, b) memset(a, b, sizeof(a))
const double eps = 1e-8;
const ll INF = 1e9;
const ll mod = 1e9 + 7;
const int maxn = 2e5+10;
using namespace std;

ll p[maxn] = {0};
ll t[maxn] = {0};

int main(){

	p[0] = 1;
	for(int i = 1; i <= 1e5; i++) p[i] = (p[i-1] * 10) % mod;
	for(int i = 2; i <= 1e5; i++) t[i] = (p[i-2] * (i-1)) % mod;
	for(int i = 1; i <= 1e5; i++) t[i] = (t[i] + t[i-1]) % mod;

	string s;
	cin >> s;
	int n = s.size();
	reverse(s.begin(), s.end());
	ll sum = 0, res = 0;
	for(int i = 0; i < n; i++){
		ll num = (n - i) * (n - i - 1) / 2 % mod;
		res = (res + ((s[i] - '0') * num * p[i] % mod)) % mod;
		res = (res + (s[i] - '0') * t[i+1]) % mod;
	}
	cout << res << endl;
	return 0;
}


#include <vector>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#define ll long long
#define chushi(a, b) memset(a, b, sizeof(a))
const double eps = 1e-8;
const ll INF = 1e9;
const ll mod = 1e9 + 7;
const int maxn = 1e5+10;
using namespace std;

ll p[maxn] = {0};
ll t[maxn] = {0};

int main(){

	p[0] = 1;
	for(int i = 1; i <= 1e5; i++) p[i] = (p[i-1] * 10) % mod;
	for(int i = 2; i <= 1e5; i++) t[i] = (p[i-2] * (i-1)) % mod;
	for(int i = 1; i <= 1e5; i++) t[i] = (t[i] + t[i-1]) % mod;

	string s;
	cin >> s;
	int n = s.size();
	reverse(s.begin(), s.end());
	ll sum = 0, res = 0;
	for(int i = 0; i < n; i++){
		ll num = (n - i) * (n - i - 1) / 2 % mod;
		res = (res + ((s[i] - '0') * num % mod * p[i] % mod)) % mod;
		res = (res + (s[i] - '0') * t[i+1]) % mod;
	}
	cout << res << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+10,mod=1e9+7;
int t,n,m;
char s[N];
int f[N];
int main(){
    scanf("%s",s+1);
    n=strlen(s+1);
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        int x=s[i]-'0';
        f[i]=f[i-1]+i-1%mod;
    }
    ll ans=0;
    for(int i=1;i<=n;i++){
            int x=s[i]-'0';
        ans=ans*10%mod+f[i]*x+sum*(n-i+1)%mod;
    sum+=x;
    }
    cout<<ans<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+10,mod=1e9+7;
int t,n,m;
char s[N];
ll f[N];
int main(){
    scanf("%s",s+1);
    n=strlen(s+1);
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        int x=s[i]-'0';
        f[i]=(ll)f[i-1]+i-1;
    }
    ll ans=0;
    for(int i=1;i<=n;i++){
            int x=s[i]-'0';
        ans=(ll)ans*10%mod+(ll)f[i]*x%mod+(ll)sum*(n-i+1)%mod;
    sum+=x;
    }
    cout<<ans%mod<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+10,mod=1e9+7;
int t,n,m;
char s[N];
int f[N];
int main(){
    scanf("%s",s+1);
    n=strlen(s+1);
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        int x=s[i]-'0';
        f[i]=(ll)f[i-1]+i-1%mod;
    }
    ll ans=0;
    for(int i=1;i<=n;i++){
            int x=s[i]-'0';
        ans=ans*10%mod+f[i]*x%mod+sum*(n-i+1)%mod;
    sum+=x;
    }
    cout<<ans<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+10,mod=1e9+7;
int t,n,m;
char s[N];
int f[N];
int main(){
    scanf("%s",s+1);
    n=strlen(s+1);
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        int x=s[i]-'0';
        f[i]=(ll)f[i-1]+i-1%mod;
    }
    ll ans=0;
    for(int i=1;i<=n;i++){
            int x=s[i]-'0';
        ans=(ll)ans*10%mod+(ll)f[i]*x%mod+(ll)sum*(n-i+1)%mod;
    sum+=x;
    }
    cout<<ans<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+10,mod=1e9+7;
int t,n,m;
char s[N];
int f[N];
int main(){
    scanf("%s",s+1);
    n=strlen(s+1);
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        int x=s[i]-'0';
        f[i]=(ll)f[i-1]+i-1%mod;
    }
    ll ans=0;
    for(int i=1;i<=n;i++){
            int x=s[i]-'0';
        ans=(ll)ans*10%mod+f[i]*x%mod+sum*(n-i+1)%mod;
    sum+=x;
    }
    cout<<ans<<endl;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
const ll mod = 1e9 + 7;

const int maxn = 1e6 + 10;

ll sum[maxn];
ll jc[maxn];

inline void init(){
	sum[0] = 0;
	ll tmp = 1;
	jc[0] = 1;
	for(int i = 1; i < maxn; i++){
		jc[i] = jc[i - 1] * 10 % mod;
		sum[i] = i * tmp % mod;
		sum[i] = (sum[i] + sum[i - 1]) % mod;
		tmp = tmp * 10 % mod;
	}

}

ll qpow(ll x, ll y, ll mod){
	ll ret = 1;

	while(y){
		if(y & 1)
			ret = ret * x % mod;
		x = x * x % mod;
		y >>= 1;
	}
	return ret % mod;
}

ll solve(const string& s){
	ll ret = 0;
	ll sze = s.size();

	for(int i = 0; i < s.size(); i++){
		ll val = s[i] - '0';
		if(!val)
			continue;
		ret += i * (i + 1) % mod * qpow(2, mod - 2, mod) * val % mod * jc[sze - 1 - i] % mod;
		ret %= mod;

		ret = (ret + val * sum[(sze - 1 - i)]) % mod;

	}

	return ret;
}

int main(){
	#ifdef FREOPEN
	freopen("input.txt", "r", stdin);
	#endif

	init();

	string s;
	cin >> s;

	cout << solve(s) << endl;

	return 0;

}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
const ll mod = 1e9 + 7;

const int maxn = 1e6 + 10;

ll sum[maxn];
ll jc[maxn];

inline void init(){
	sum[0] = 0;
	ll tmp = 1;
	jc[0] = 1;
	for(int i = 1; i < maxn; i++){
		jc[i] = jc[i - 1] * 10 % mod;
		sum[i] = i * tmp % mod;
		sum[i] = (sum[i] + sum[i - 1]) % mod;
		tmp = tmp * 10 % mod;
	}

}

ll solve(const string& s){
	ll ret = 0;
	ll sze = s.size();

	for(int i = 0; i < s.size(); i++){
		ll val = s[i] - '0';
		if(!val)
			continue;
		ret += i * (i + 1) / 2 * val % mod * jc[sze - 1 - i] % mod;
		ret %= mod;

		ret = (ret + val * sum[(sze - 1 - i)]) % mod;

	}

	return ret;
}

int main(){
	#ifdef FREOPEN
	freopen("input.txt", "r", stdin);
	#endif

	init();

	string s;
	cin >> s;

	cout << solve(s) << endl;

	return 0;

}


#include<bits/stdc++.h>

using namespace std;

typedef unsigned long long ll;
const ll mod = 1e9 + 7;

const int maxn = 1e6 + 10;

ll sum[maxn];
ll jc[maxn];

inline void init(){
	sum[0] = 0;
	ll tmp = 1;
	jc[0] = 1;
	for(int i = 1; i < maxn; i++){
		jc[i] = jc[i - 1] * 10 % mod;
		sum[i] = i * tmp % mod;
		sum[i] = (sum[i] + sum[i - 1]) % mod;
		tmp = tmp * 10 % mod;
	}

}

ll qpow(ll x, ll y, ll mod){
	ll ret = 1;

	while(y){
		if(y & 1)
			ret = ret * x % mod;
		x = x * x % mod;
		y >>= 1;
	}
	return ret % mod;
}

ll solve(const string& s){
	ll ret = 0;
	ll sze = s.size();

	for(ll i = 0; i < s.size(); i++){
		ll val = s[i] - '0';
		if(!val)
			continue;
		ret += i * (i + 1) % mod * qpow(2, mod - 2, mod) * val % mod * jc[sze - 1 - i] % mod;
		ret %= mod;

		ret = (ret + val * sum[(sze - 1 - i)]) % mod;

	}

	return ret;
}

int main(){
	#ifdef FREOPEN
	freopen("input.txt", "r", stdin);
	#endif

	init();

	string s;
	cin >> s;

	cout << solve(s) << endl;

	return 0;

}


#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
ll sp[maxn];
const ll mm = 1e9 + 7;
int main()
{
    string s;
    cin >> s;
    for (int i = 0; i < s.length();++i)
    {
        sp[i] = s[i] - '0';
    }
    ll p = 1;
    ll sum = 0;
    ll ans = 0;
    int len = s.length();
    ll res;
    for (ll i = len - 1; i >= 0;--i)
    {
        res = (i * (i + 1) / 2%mm * p%mm + sum) % mm;
        sum = (sum%mm + (len - i) * p%mm)%mm;
        p = p * 10 % mm;
        ans = (ans%mm + (res%mm * sp[i]%mm)%mm%mm) % mm;
    }
    cout << ans << '\n';
    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
ll sp[maxn];
const ll mm = 1e9 + 7;
int main()
{
    string s;
    cin >> s;
    for (int i = 0; i < s.length();++i)
    {
        sp[i] = s[i] - '0';
    }
    ll p = 1;
    ll sum = 0;
    ll ans = 0;
    int len = s.length();
    ll res;
    for (int i = len - 1; i >= 0;--i)
    {
        res = ((i * (i + 1) / 2)%mm * p%mm + sum) % mm;
        sum = (sum%mm + (len - i) * p%mm)%mm;
        p = p * 10 % mm;
        ans = (ans%mm + (res%mm * sp[i]%mm)%mm%mm) % mm;
    }
    cout << ans << '\n';
    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
ll sp[maxn];
const ll mm = 1e9 + 7;
int main()
{
    string s;
    cin >> s;
    for (int i = 0; i < s.length();++i)
    {
        sp[i] = s[i] - '0';
    }
    ll p = 1;
    ll sum = 0;
    ll ans = 0;
    int len = s.length();
    ll res;
    for (int i = len - 1; i >= 0;--i)
    {
        res = (i * (i + 1) / 2%mm * p%mm + sum) % mm;
        sum = (sum%mm + (len - i) * p%mm)%mm;
        p = p * 10 % mm;
        ans = (ans%mm + (res%mm * sp[i]%mm)%mm%mm) % mm;
    }
    cout << ans << '\n';
    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
ll sp[maxn];
const ll mm = 1e9 + 7;
int main()
{
    string s;
    cin >> s;
    for (int i = 0; i < s.length();++i)
    {
        sp[i] = s[i] - '0';
    }
    ll p = 1;
    ll sum = 0;
    ll ans = 0;
    int len = s.length();
    ll res;
    for (ll i = len - 1; i >= 0;--i)
    {
        res = (i * (i + 1) / 2%mm * p%mm + sum) % mm;
        sum = (sum + (len - i) * p%mm)%mm;
        p = p * 10 % mm;
        ans = (ans + res * sp[i]%mm) % mm;
    }
    cout << ans << '\n';
    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
ll sp[maxn];
const ll mm = 1e9 + 7;
int main()
{
    string s;
    cin >> s;
    for (int i = 0; i < s.length();++i)
    {
        sp[i] = s[i] - '0';
    }
    ll p = 1;
    ll sum = 0;
    ll ans = 0;
    int len = s.length();
    ll res;
    for (int i = len - 1; i >= 0;--i)
    {
        res = (((i%mm * (i + 1)%mm)%mm / 2)%mm * p%mm + sum%mm) % mm;
        sum = (sum%mm + (len - i) * p%mm)%mm;
        p = p * 10 % mm;
        ans = (ans%mm + (res%mm * sp[i]%mm)%mm%mm) % mm;
    }
    cout << ans << '\n';
    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
ll sp[maxn];
const ll mm = 1e9 + 7;
int main()
{
    string s;
    cin >> s;
    for (int i = 0; i < s.length();++i)
    {
        sp[i] = s[i] - '0';
    }
    ll p = 1;
    ll sum = 0;
    ll ans = 0;
    int len = s.length();
    ll res;
    for (int i = len - 1; i >= 0;--i)
    {
        res = ((i * (i + 1) / 2)%mm * p%mm + sum%mm) % mm;
        sum = (sum%mm + (len - i) * p%mm)%mm;
        p = p * 10 % mm;
        ans = (ans%mm + (res%mm * sp[i]%mm)%mm%mm) % mm;
    }
    cout << ans << '\n';
    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
ll sp[maxn];
const ll mm = 1e9 + 7;
int main()
{
    string s;
    cin >> s;
    for (int i = 0; i < s.length();++i)
    {
        sp[i] = s[i] - '0';
    }
    ll p = 1;
    ll sum = 0;
    ll ans = 0;
    int len = s.length();
    ll res;
    for (int i = len - 1; i >= 0;--i)
    {
        res = (((i * (i + 1) / 2)%mm * p%mm)%mm + sum%mm) % mm;
        sum = (sum%mm + (len - i) * p%mm)%mm;
        p = p * 10 % mm;
        ans = (ans%mm + (res%mm * sp[i]%mm)%mm%mm) % mm;
    }
    cout << ans << '\n';
    return 0;
}


#include<bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d", &x)
#define scs(x) scanf("%s", x)
#define scl(x) scanf("%lld", &x)
#define mst(a,x) memset(a, x, sizeof(a))
#define rep(i,s,e) for(int i=s; i<e; ++i)
#define dep(i,e,s) for(int i=e; i>=s; --i)
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
const int mod = 1e9+7;
char s[100005];
int main()
{
	cin>>(s + 1);
	int n = strlen(s + 1);
	ll res = 0;
	ll sum = 0;
	ll cnt = 1;
	dep(i,n,1){
		ll num = i * (i - 1) / 2;
		res = (res % mod + (s[i] - '0') * cnt % mod * num % mod) % mod;
		res = (res % mod + (s[i] - '0') % mod * sum % mod) % mod;
		sum = (sum % mod + (n - i + 1) * cnt % mod) % mod;
		cnt = cnt * 10 % mod;
	}
	pf("%lld\n",res);
}


#include<bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d", &x)
#define scs(x) scanf("%s", x)
#define scl(x) scanf("%lld", &x)
#define mst(a,x) memset(a, x, sizeof(a))
#define rep(i,s,e) for(int i=s; i<e; ++i)
#define dep(i,e,s) for(int i=e; i>=s; --i)
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
const int mod = 1e9+7;
char s[100005];
int main()
{
	cin>>(s + 1);
	int n = strlen(s + 1);
	ll res = 0;
	ll sum = 0;
	ll cnt = 1;
	for(ll i = n;i >= 1;i--)
		ll num = i * (i - 1) / 2;
		res = (res % mod + (s[i] - '0') * cnt % mod * num % mod) % mod;
		res = (res % mod + (s[i] - '0') % mod * sum % mod) % mod;
		sum = (sum % mod + (n - i + 1) * cnt % mod) % mod;
		cnt = cnt * 10 % mod;
	}
	pf("%lld\n",res);
}


#include<bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d", &x)
#define scs(x) scanf("%s", x)
#define scl(x) scanf("%lld", &x)
#define mst(a,x) memset(a, x, sizeof(a))
#define rep(i,s,e) for(int i=s; i<e; ++i)
#define dep(i,e,s) for(int i=e; i>=s; --i)
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
const int mod = 1e9+7;
char s[100005];
int main()
{
	cin>>(s + 1);
	int n = strlen(s + 1);
	ll res = 0;
	ll sum = 0;
	ll cnt = 1;
	dep(i,n,1){
		ll num = 1ll * i * 1ll * (i - 1) / 2;
		res = (res % mod + (s[i] - '0') * cnt % mod * num % mod) % mod;
		res = (res % mod + (s[i] - '0') % mod * sum % mod) % mod;
		sum = (sum % mod + (n - i + 1) * cnt % mod) % mod;
		cnt = cnt * 10 % mod;
	}
	pf("%lld\n",res);
}


#include<bits/stdc++.h>
#define se second
#define fi first
#define pb push_back
#define mt make_tuple
#define cn cout<<"\n"
#define rep(i,a,b) for(int i = a; i < b; i++)
#define repr(i,a,b) for(int i = a; i >= b; i--)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

#define _ ios::sync_with_stdio(0); cin.tie(0);

#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define ll long long
#define vll vector<ll>
#define flush fflush(stdout)

const int INF = 1e8;
const ll MOD = 1e9 + 7;

using namespace std;

ll POW(ll a, ll b, ll mod){
	ll ans = 1;
	for(;b;b>>=1,a=a*a%mod)
		if(b&1) ans=ans*a%mod;
	return ans;
}

int main(){
	_

	int t = 1, n;

	string s;
	cin>>s;

	ll total = 0;
	ll pot = s.length() - 1;
	for(int i = 0; i < s.length(); i++){
		ll num = s[i] - '0';
		total = (total + num * POW(10LL, pot--, MOD)) % MOD;
	}

	// cout<<"total "<<total; cn;

	ll ans = 0;
	pot = s.length() - 1;
	ll prefixSum = 0;
	for(int i = 0; i < s.length(); i++){
		ll num = s[i] - '0';
		ll left = i * (i + 1) / 2; left++;

/*		cout<<"----------"; cn;
		cout<<"left :"<<left; cn;
		cout<<"pot :"<<pot; cn;
		cout<<"pre :"<<prefixSum; cn;
/*
		ll
		cout<<"aux "<<aux; cn;
*/
		ll aux = (prefixSum * (pot + 1) * POW(10LL, pot, MOD)) % MOD;
		aux += num * (left * POW(10LL, pot, MOD)) % MOD; aux = aux % MOD;

		ans = (ans + aux) % MOD;
		pot--;
		prefixSum += num;
	}

	cout<<(ans + MOD - total) % MOD; cn;

	return 0;
}


#include<bits/stdc++.h>
#define se second
#define fi first
#define pb push_back
#define mt make_tuple
#define cn cout<<"\n"
#define rep(i,a,b) for(int i = a; i < b; i++)
#define repr(i,a,b) for(int i = a; i >= b; i--)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

#define _ ios::sync_with_stdio(0); cin.tie(0);

#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define ll long long
#define vll vector<ll>
#define flush fflush(stdout)

const int INF = 1e8;
const ll MOD = 1e9 + 7;

using namespace std;

ll POW(ll a, ll b, ll mod){
	ll ans = 1;
	for(;b;b>>=1,a=a*a%mod)
		if(b&1) ans=ans*a%mod;
	return ans;
}

int main(){
	_

	int t = 1, n;

	string s;
	cin>>s;

	ll total = 0;
	ll pot = s.length() - 1;
	for(int i = 0; i < s.length(); i++){
		ll num = s[i] - '0';
		total = (total + num * POW(10LL, pot--, MOD)) % MOD;
	}

	// cout<<"total "<<total; cn;

	ll ans = 0;
	pot = s.length() - 1;
	ll prefixSum = 0;
	for(int i = 0; i < s.length(); i++){
		ll num = s[i] - '0';
		ll x = i;
		ll left = x * (x + 1) / 2; left++;
		left = left % MOD;
/*		cout<<"----------"; cn;
		cout<<"left :"<<left; cn;
		cout<<"pot :"<<pot; cn;
		cout<<"pre :"<<prefixSum; cn;
/*
		ll
		cout<<"aux "<<aux; cn;
*/
		ll coef = prefixSum * (pot + 1) % MOD;
		ll aux = (coef * POW(10LL, pot, MOD)) % MOD;
		aux += num * (left * POW(10LL, pot, MOD)) % MOD; aux = aux % MOD;

		ans = (ans + aux) % MOD;
		pot--;
		prefixSum += num;
	}

	cout<<(ans + MOD - total) % MOD; cn;

	return 0;
}


#include<bits/stdc++.h>
#define se second
#define fi first
#define pb push_back
#define mt make_tuple
#define cn cout<<"\n"
#define rep(i,a,b) for(int i = a; i < b; i++)
#define repr(i,a,b) for(int i = a; i >= b; i--)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

#define _ ios::sync_with_stdio(0); cin.tie(0);

#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define ll long long
#define vll vector<ll>
#define flush fflush(stdout)

const int INF = 1e8;
const ll MOD = 1e9 + 7;

using namespace std;

ll POW(ll a, ll b, ll mod){
	ll ans = 1;
	for(;b;b>>=1,a=a*a%mod)
		if(b&1) ans=ans*a%mod;
	return ans;
}

int main(){
	_

	int t = 1, n;

	string s;
	cin>>s;

	ll ans = 0, pot = s.length() - 1, prefixSum = 0;
	for(int i = 0; i < s.length(); i++){
		ll num = s[i] - '0', x = i;
		ll left = (x * (x + 1) / 2) % MOD;
		ll coef = prefixSum * (pot + 1) % MOD;
		ll aux = (coef * POW(10LL, pot, MOD)) % MOD;
		aux += num * (left * POW(10LL, pot, MOD)) % MOD; aux = aux % MOD;
		ans = (ans + aux) % MOD;
		pot--;
		prefixSum += num;
	}

	cout<<(ans + MOD) % MOD; cn;

	return 0;
}


#include<bits/stdc++.h>
#define se second
#define fi first
#define pb push_back
#define mt make_tuple
#define cn cout<<"\n"
#define rep(i,a,b) for(int i = a; i < b; i++)
#define repr(i,a,b) for(int i = a; i >= b; i--)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

#define _ ios::sync_with_stdio(0); cin.tie(0);

#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define ll long long
#define vll vector<ll>
#define flush fflush(stdout)

const int INF = 1e8;
const ll MOD = 1e9 + 7;

using namespace std;

ll POW(ll a, ll b, ll mod){
	ll ans = 1;
	for(;b;b>>=1,a=a*a%mod)
		if(b&1) ans=ans*a%mod;
	return ans;
}

int main(){
	_

	int t = 1, n;

	string s;
	cin>>s;

	ll total = 0;
	ll pot = s.length() - 1;
	for(int i = 0; i < s.length(); i++){
		ll num = s[i] - '0';
		total = (total + num * POW(10LL, pot--, MOD)) % MOD;
	}

	// cout<<"total "<<total; cn;

	ll ans = 0;
	pot = s.length() - 1;
	ll prefixSum = 0;
	for(int i = 0; i < s.length(); i++){
		ll num = s[i] - '0';
		ll left = i * (i + 1) / 2; left++;
		left = left % MOD;
/*		cout<<"----------"; cn;
		cout<<"left :"<<left; cn;
		cout<<"pot :"<<pot; cn;
		cout<<"pre :"<<prefixSum; cn;
/*
		ll
		cout<<"aux "<<aux; cn;
*/
		ll coef = prefixSum * (pot + 1) % MOD;
		ll aux = (coef * POW(10LL, pot, MOD)) % MOD;
		aux += num * (left * POW(10LL, pot, MOD)) % MOD; aux = aux % MOD;

		ans = (ans + aux) % MOD;
		pot--;
		prefixSum += num;
	}

	cout<<(ans + MOD - total) % MOD; cn;

	return 0;
}


#include <bits/stdc++.h>
#define int long long
using namespace std;

int md = 1000000000+7;

int pow1(int x,int y){
    if (y == 0){
        return 1;
    }
    else {
        int q = pow1(x,y/2);
        if (y%2 == 1){
            return q*q*x;
        }
        else {
            return q*q;
        }
    }
}

int ss[1000000];
int psum1[1000000];

signed main() {

string s;

cin >> s;

if (s.size() == 1){
    cout << 0 << endl;
    return 0;
}

vector <int> v1;
vector <int> v2;

int res = 0;

int sum1 = 0;
int sum2 = 0;
for (int i=0;i<s.length()-1;i++){
    sum1=sum1*10+(s[i]&0x0F);
    sum1%=md;
    v1.push_back(sum1);
    res+=sum1;
    res%=md;
}

for (int i=s.length()-1;i>=1;i--){
    sum2=sum2+(s[i]&0x0F)*pow1(10,abs(i-s.length()+1));
    sum2%=md;
    v2.push_back(sum2);
    res+=sum2;
    res%=md;
}

for (int i=1;i<=v1.size();i++){
    ss[i] = ss[i-1]+pow1(10,i);
    ss[i]%=md;
}

reverse(v2.begin(),v2.end());

for (int i=v2.size()-1;i>=0;i--){
    psum1[i] = psum1[i+1]+v2[i];
    psum1[i]%=md;
}

for (int i=0;i<v1.size()-1;i++){
    res+=psum1[i+1];
    res%=md;
    res+=v1[i]*ss[v1.size()-i-2+1];
    res%=md;
}

cout << res << endl;

return 0;
}


#include <bits/stdc++.h>
#define int long long
using namespace std;

int md = 1000000000+7;

int pow1(int x,int y){
    if (y == 0){
        return 1;
    }
    else {
        int q = pow1(x,y/2);
        if (y%2 == 1){
            return q*q*x;
        }
        else {
            return q*q;
        }
    }
}

int ss[1000000];
int psum1[1000000];

signed main() {

string s;

cin >> s;

if (s.size() == 1){
    cout << 0 << endl;
    return 0;
}

vector <int> v1;
vector <int> v2;

int res = 0;

int sum1 = 0;
int sum2 = 0;
for (int i=0;i<s.length()-1;i++){
    sum1=sum1*10+(s[i]&0x0F);
    sum1%=md;
    v1.push_back(sum1);
    res+=sum1;
    res%=md;
}

for (int i=s.length()-1;i>=1;i--){
    sum2=sum2+(s[i]&0x0F)*pow1(10,abs(i-s.length()+1));
    sum2%=md;
    v2.push_back(sum2);
    res+=sum2;
    res%=md;
}

for (int i=1;i<=v1.size();i++){
    ss[i] = ss[i-1]+pow1(10,i);
    ss[i]%=md;
}

reverse(v2.begin(),v2.end());

for (int i=v2.size()-1;i>=0;i--){
    psum1[i] = psum1[i+1]+v2[i];
    psum1[i]%=md;
}

for (int i=0;i<v1.size()-1;i++){
    res+=psum1[i+1];
    res%=md;
    res+=((v1[i]*ss[v1.size()-i-2+1])%md);
    res%=md;
}

cout << res << endl;

return 0;
}


#include <bits/stdc++.h>
#define int long long
using namespace std;

int md = 1000000000+7;

int pow1(int x,int y){
    if (y == 0){
        return 1;
    }
    else {
        int q = pow1(x,y/2);
        if (y%2 == 1){
            return q*q*x;
        }
        else {
            return q*q;
        }
    }
}

int ss[1000000];
int psum1[1000000];

signed main() {

string s;

cin >> s;

vector <int> v1;
vector <int> v2;

int res = 0;

int sum1 = 0;
int sum2 = 0;
for (int i=0;i<s.length()-1;i++){
    sum1=sum1*10+(s[i]&0x0F);
    sum1%=md;
    v1.push_back(sum1);
    res+=sum1;
    res%=md;
}

for (int i=s.length()-1;i>=1;i--){
    sum2=sum2+(s[i]&0x0F)*pow1(10,abs(i-s.length()+1));
    sum2%=md;
    v2.push_back(sum2);
    res+=sum2;
    res%=md;
}

for (int i=1;i<=v1.size();i++){
    ss[i] = ss[i-1]+pow1(10,i);
    ss[i]%=md;
}

reverse(v2.begin(),v2.end());

for (int i=v2.size()-1;i>=0;i--){
    psum1[i] = psum1[i+1]+v2[i];
    psum1[i]%=md;
}

for (int i=0;i<v1.size()-1;i++){
    res+=psum1[i+1];
    res%=md;
    res+=v1[i]*ss[v1.size()-i-2+1];
    res%=md;
}

cout << res << endl;

return 0;
}


#include <bits/stdc++.h>
#define int long long
using namespace std;

int md = 1000000000+7;

int pow1(int x,int y){
    if (y == 0){
        return 1;
    }
    else {
        int q = pow1(x,y/2);
        if (y%2 == 1){
            return (((q*q)%md)*(x%md))%md;
        }
        else {
            return (q*q)%md;
        }
    }
}

int ss[1100000];
int psum1[1100000];

signed main() {

string s;

cin >> s;

if (s.size() == 1){
    cout << 0 << endl;
    return 0;
}

vector <int> v1;
vector <int> v2;

int res = 0;
int sum1 = 0;
int sum2 = 0;
for (int i=0;i<s.length()-1;i++){
    sum1=sum1*10+(s[i]&0x0F);
    sum1%=md;
    v1.push_back(sum1);
    res+=sum1;
    res%=md;
}

for (int i=s.length()-1;i>=1;i--){
    sum2=sum2+(s[i]&0x0F)*pow1(10,abs(i-s.length()+1));
    sum2%=md;
    v2.push_back(sum2);
    res+=sum2;
    res%=md;
}

for (int i=1;i<=v1.size();i++){
    ss[i] = ss[i-1]+pow1(10,i);
    ss[i]%=md;
}

reverse(v2.begin(),v2.end());

for (int i=v2.size()-1;i>=0;i--){
    psum1[i] = psum1[i+1]+v2[i];
    psum1[i]%=md;
}

for (int i=0;i<v1.size()-1;i++){
    res+=psum1[i+1];
    res%=md;
    res+=((v1[i]*ss[v1.size()-i-2+1])%md);
    res%=md;
}

cout << res%md << endl;

return 0;
}


#include <bits/stdc++.h>
#define int long long
using namespace std;

int md = 1000000000+7;

int pow1(int x,int y){
    if (y == 0){
        return 1;
    }
    else {
        int q = pow1(x,y/2);
        if (y%2 == 1){
            return ((q*q)%md)*(x%md);
        }
        else {
            return (q*q)%md;
        }
    }
}

int ss[1000000];
int psum1[1000000];

signed main() {

string s;

cin >> s;

if (s.size() == 1){
    cout << 0 << endl;
    return 0;
}

vector <int> v1;
vector <int> v2;

int res = 0;
int sum1 = 0;
int sum2 = 0;
for (int i=0;i<s.length()-1;i++){
    sum1=sum1*10+(s[i]&0x0F);
    sum1%=md;
    v1.push_back(sum1);
    res+=sum1;
    res%=md;
}

for (int i=s.length()-1;i>=1;i--){
    sum2=sum2+(s[i]&0x0F)*pow1(10,abs(i-s.length()+1));
    sum2%=md;
    v2.push_back(sum2);
    res+=sum2;
    res%=md;
}

for (int i=1;i<=v1.size();i++){
    ss[i] = ss[i-1]+pow1(10,i);
    ss[i]%=md;
}

reverse(v2.begin(),v2.end());

for (int i=v2.size()-1;i>=0;i--){
    psum1[i] = psum1[i+1]+v2[i];
    psum1[i]%=md;
}

for (int i=0;i<v1.size()-1;i++){
    res+=psum1[i+1];
    res%=md;
    res+=((v1[i]*ss[v1.size()-i-2+1])%md);
    res%=md;
}

cout << res%md << endl;

return 0;
}


#include<bits/stdc++.h>
using namespace std;

//-std=c++11
//#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define LL long long
#define FI ios_base::sync_with_stdio(false); cin.tie(NULL);
#define PREC cout << setprecision(10) << fixed;

#define int long long

const int MOD = 1e9 + 7;
const int INF = 1e9 + 9;
const int MX = 1e5 + 5;

int mod10[MX];
void calc() {
	mod10[0] = 1;
	for(int i=1;i<MX;i++) {
		mod10[i] = (mod10[i-1] * 10)%MOD;
	}
}

#undef int
int main() {
	#define int long long

	calc();

	string s;
	cin >> s;

	int n = s.size();
	vector<int> inp(n);
	for(int i=1;i<=n;i++) {
		inp[i] = s[i-1] - '0';
	}

	int ans = 0;

	vector<int> pre(n+1);
	pre[0] = 0;
	for(int i=1;i<=n;i++) {
		pre[i] = ((pre[i-1] * 10)%MOD + inp[i])%MOD;

		if(i != n)
			ans = (ans + pre[i])%MOD;
	}

	vector<int> preSum(n+1);
	preSum[0] = 0;
	for(int i=1;i<=n;i++) {
		preSum[i] = (preSum[i-1] + pre[i])%MOD;
	}

	vector<int> suff(n+1);
	suff[n+1] = 0;
	for(int j=n;j>=1;j--) {
		int l = n - j;
		suff[j] = ((inp[j] * mod10[l])%MOD + suff[j+1])%MOD;

		if(j != 1) {
			ans = (ans + suff[j])%MOD;
		}
	}

	for(int j=n;j>=3;j--) {
		int l = n - j + 1;
		int ret = ((preSum[j-2] * mod10[l])%MOD + ((j - 2) * suff[j])%MOD)%MOD;
		ans = (ans + ret)%MOD;
	}

	cout << ans << endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;

//-std=c++11
//#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define LL long long
#define FI ios_base::sync_with_stdio(false); cin.tie(NULL);
#define PREC cout << setprecision(10) << fixed;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 9;
const int MX = 1e5 + 5;

#define int long long
int mod10[MX];
void calc() {
	mod10[0] = 1;
	for(int i=1;i<MX;i++) {
		mod10[i] = (mod10[i-1] * 10)%MOD;
	}
}

#undef int
int main() {
	#define int long long

	calc();

	string s;
	cin >> s;

	int n = (int)s.size();
	vector<int> inp(n);
	for(int i=1;i<=n;i++) {
		inp[i] = s[i-1] - '0';
	}

	int ans = 0;

	vector<int> pre(n+1);
	pre[0] = 0;
	for(int i=1;i<=n;i++) {
		pre[i] = ((pre[i-1] * 10)%MOD + inp[i])%MOD;

		if(i != n)
			ans = (ans + pre[i])%MOD;
	}

	vector<int> preSum(n+1);
	preSum[0] = 0;
	for(int i=1;i<=n;i++) {
		preSum[i] = (preSum[i-1] + pre[i])%MOD;
	}

	vector<int> suff(n+1);
	suff[n+1] = 0;
	for(int j=n;j>=1;j--) {
		int l = n - j;
		suff[j] = ((inp[j] * mod10[l])%MOD + suff[j+1])%MOD;

		if(j != 1) {
			ans = (ans + suff[j])%MOD;
		}
	}

	for(int j=n;j>=3;j--) {
		int l = n - j + 1;
		int ret = ((preSum[j-2] * mod10[l])%MOD + ((j - 2) * suff[j])%MOD)%MOD;
		ans = (ans + ret)%MOD;
	}

	cout << ans << endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;

//-std=c++11
//#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define LL long long
#define FI ios_base::sync_with_stdio(false); cin.tie(NULL);
#define PREC cout << setprecision(10) << fixed;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 9;
const int MX = 1e5 + 5;

#define int long long

int mod10[MX];
void calc() {
	mod10[0] = 1;
	for(int i=1;i<MX;i++) {
		mod10[i] = (mod10[i-1] * 10)%MOD;
	}
}

#undef int
int main() {
	#define int long long

	calc();

	string s;
	cin >> s;

	int n = s.size();
	vector<int> inp(n);
	for(int i=1;i<=n;i++) {
		inp[i] = s[i-1] - '0';
	}

	int ans = 0;

	vector<int> pre(n+1);
	pre[0] = 0;
	for(int i=1;i<=n;i++) {
		pre[i] = ((pre[i-1] * 10)%MOD + inp[i])%MOD;

		if(i != n)
			ans = (ans + pre[i])%MOD;
	}

	vector<int> preSum(n+1);
	preSum[0] = 0;
	for(int i=1;i<=n;i++) {
		preSum[i] = (preSum[i-1] + pre[i])%MOD;
	}

	vector<int> suff(n+1);
	suff[n+1] = 0;
	for(int j=n;j>=1;j--) {
		int l = n - j;
		suff[j] = ((inp[j] * mod10[l])%MOD + suff[j+1])%MOD;

		if(j != 1) {
			ans = (ans + suff[j])%MOD;
		}
	}

	for(int j=n;j>=3;j--) {
		int l = n - j + 1;
		int ret = ((preSum[j-2] * mod10[l])%MOD + ((j - 2) * suff[j])%MOD)%MOD;
		ans = (ans + ret)%MOD;
	}

	cout << ans << endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;

//-std=c++11
//#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define LL long long
#define FI ios_base::sync_with_stdio(false); cin.tie(NULL);
#define PREC cout << setprecision(10) << fixed;

#define int long long

const int MOD = 1e9 + 7;
const int INF = 1e9 + 9;
const int MX = 1e5 + 5;

int mod10[MX];
void calc() {
	mod10[0] = 1;
	for(int i=1;i<MX;i++) {
		mod10[i] = (mod10[i-1] * 10)%MOD;
	}
}

string s;
int n;
int inp[MX];

int pre[MX], preSum[MX];
int suff[MX];

#undef int
int main() {
	#define int long long

	calc();

	cin >> s;
	int n = s.size();
	for(int i=1;i<=n;i++) {
		inp[i] = (s[i-1] - '0');
	}

	int ans = 0;

	pre[0] = 0;
	for(int i=1;i<=n;i++) {
		pre[i] = ((pre[i-1] * 10)%MOD + inp[i])%MOD;

		if(i != n)
			ans = (ans + pre[i])%MOD;
	}
	preSum[0] = 0;
	for(int i=1;i<=n;i++) {
		preSum[i] = (preSum[i-1] + pre[i])%MOD;
	}

	suff[n+1] = 0;
	for(int j=n;j>=1;j--) {
		int l = n - j;
		suff[j] = ((inp[j] * mod10[l])%MOD + suff[j+1])%MOD;

		if(j != 1) {
			ans = (ans + suff[j])%MOD;
		}
	}

	for(int j=n;j>=3;j--) {
		int l = n - j + 1;
		int ret = ((preSum[j-2] * mod10[l])%MOD + ((j - 2) * suff[j])%MOD)%MOD;
		ans = (ans + ret)%MOD;
	}

	cout << ans << endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+10;
const int mod = 1e9+7;
ll a[maxn],c[maxn],p[maxn],ans,n;
int main()
{
	while(scanf("%1lld",&a[n+1]) == 1) n++;
	p[0] = 1;
	for(int i=1;i<=n;i++) p[i] = p[i-1]*10%mod;
	for(ll i=1;i<=n;i++) {
		ans = (ans+(i*(i-1)/2)%mod*p[n-i]%mod*a[i]%mod)%mod;//选择删去i位之前的串
		if(ans>=mod) ans%=mod;
		c[n-i+1] = (c[n-i+1]-a[i])%mod;//做差分
		c[1] = (c[1]+a[i])%mod;
	}
	ll res = 0;
	for(int i=1;i<=n;i++) {
		res = (c[i]+res)%mod;
		ans = (ans + res*p[i-1]%mod*i%mod)%mod;//选择删去i位之后的串
	}
	cout<<ans%mod<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+10;
const int mod = 1e9+7;
ll a[maxn],c[maxn],p[maxn],ans,n;
int main()
{
	while(scanf("%1lld",&a[n+1]) == 1) n++;
	p[0] = 1;
	for(int i=1;i<=n;i++) p[i] = p[i-1]*10%mod;
	for(int i=1;i<=n;i++) {
		ans = (ans+(i*(i-1)/2)%mod*p[n-i]%mod*a[i]%mod)%mod;//选择删去i位之前的串
		if(ans>=mod) ans%=mod;
		c[n-i+1] = (c[n-i+1]-a[i])%mod;//做差分
		c[1] = (c[1]+a[i])%mod;
	}
	ll res = 0;
	for(int i=1;i<=n;i++) {
		res = (c[i]+res)%mod;
		ans = (ans + res*p[i-1]%mod*i%mod)%mod;//选择删去i位之后的串
	}
	cout<<ans%mod<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+10;
const int mod = 1e9+7;
ll a[maxn],c[maxn],p[maxn],ans,n;
int main()
{
	while(scanf("%1lld",&a[n+1]) == 1) n++;
	p[0] = 1;
	for(int i=1;i<=n;i++) p[i] = p[i-1]*10%mod;
	for(int i=1;i<=n;i++) {
		ans += (i*(i-1)/2)%mod*p[n-i]%mod*a[i]%mod;//选择删去i位之前的串
		if(ans>=mod) ans%=mod;
		c[n-i+1] = (c[n-i+1]-a[i])%mod;//做差分
		c[1] = (c[1]+a[i])%mod;
	}
	ll res = 0;
	for(int i=1;i<=n;i++) {
		res = (c[i]+res)%mod;
		ans = (ans + res*p[i-1]%mod*i%mod)%mod;//选择删去i位之后的串
	}
	cout<<ans%mod<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+10;
const int mod = 1e9+7;
ll a[maxn],c[maxn],p[maxn],ans,n;
int main()
{
	while(scanf("%1lld",&a[n+1]) == 1) n++;
	p[0] = 1;
	for(int i=1;i<=n;i++) p[i] = p[i-1]*10%mod;
	for(int i=1;i<=n;i++) {
		ans += (i*(i-1)/2)%mod*p[n-i]%mod*a[i]%mod;//选择删去i位之前的串
		ans = (ans+mod)%mod;
		c[n-i+1] = (c[n-i+1]-a[i])%mod;//做差分
		c[1] = (c[1]+a[i])%mod;
	}
	ll res = 0;
	for(int i=1;i<=n;i++) {
		res = (c[i]+res)%mod;
		ans = (ans + res*p[i-1]%mod*i%mod)%mod;//选择删去i位之后的串
	}
	cout<<ans%mod<<endl;
}


#include <bits/stdc++.h>

using namespace std;
const int MOD = 1000000007;
char s[100001];
long long sum;
long long p10[100001];
long long a[100001];
int n;
void cate_stanga(int left,int value)
{
 long long  combinari= (left * (left+1))/2;
 combinari%=MOD;
 //cout<<"*"<<combinari<<"*";
// cout<<combinari;
 sum+=combinari*p10[n-left-1]*value;
 sum%=MOD;

}
void cate_dreapta(int left,int value)
{

    sum+=value*a[n-left-1];
    sum%=MOD;
}
int main()
{
    int i;
    cin>>s;
     n=strlen(s);
  p10[0]=1;
  for(i=1;i<=n;i++)
    p10[i]=10*p10[i-1],p10[i]%=MOD;
  a[1]=1;
  //cout<<p10[2];
  for(i=2;i<=n;i++)
    a[i]=a[i-1]+p10[i-1]*(i),a[i]%=MOD;

for(i=0;s[i];i++)
{
    int value = s[i] - '0';
//cout<<value<<'*';
    cate_stanga(i,value);
    //cout<<sum<<' ';
    cate_dreapta(i,value);
    //cout<<sum<<' ';
}
cout<<sum;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
const int MOD = 1000000007;
char s[100001];
unsigned long long sum;
long long p10[100001];
long long a[100001];
int n;
void cate_stanga(int left,int value)
{
 unsigned long long  combinari= (left * (left+1))/2;
 combinari%=MOD;
 //cout<<"*"<<combinari<<"*";
// cout<<combinari;
long long add=combinari*p10[n-left-1];
add%=MOD;
add*=value;
add%=MOD;
 sum+=add;
 sum%=MOD;

}
void cate_dreapta(int left,int value)
{
//cout<<left;
long long add=value*a[n-left-1];
add%=MOD;
    sum+=add;
    sum%=MOD;
}
int main()
{
    int i;
    cin>>s;
     n=strlen(s);
  p10[0]=1;
  for(i=1;i<=n;i++)
    p10[i]=10*p10[i-1],p10[i]%=MOD;
  a[1]=1;
  //cout<<p10[2];
  for(i=2;i<=n;i++)
    a[i]=a[i-1]+p10[i-1]*(i),a[i]%=MOD;

for(i=0;s[i];i++)
{
    int value = s[i] - '0';
//cout<<value<<'*';
    cate_stanga(i,value);
    //cout<<sum<<' ';
    cate_dreapta(i,value);
    //cout<<sum<<' ';
}
cout<<sum;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
const int MOD = 1000000007;
char s[100001];
unsigned long long sum;
long long p10[100001];
long long a[100001];
int n;
void cate_stanga(long long left,int value)
{
 unsigned long long  combinari= (left * (left+1))/2;
 combinari%=MOD;
 //cout<<"*"<<combinari<<"*";
// cout<<combinari;
long long add=combinari*p10[n-left-1];
add%=MOD;
add*=value;
add%=MOD;
 sum+=add;
 sum%=MOD;

}
void cate_dreapta(long long left,int value)
{
//cout<<left;
long long add=value*a[n-left-1];
add%=MOD;
    sum+=add;
    sum%=MOD;
}
int main()
{
    int i;
    cin>>s;
     n=strlen(s);
  p10[0]=1;
  for(i=1;i<=n;i++)
    p10[i]=10*p10[i-1],p10[i]%=MOD;
  a[1]=1;
  //cout<<p10[2];
  for(i=2;i<=n;i++)
    a[i]=a[i-1]+p10[i-1]*(i),a[i]%=MOD;

for(i=0;s[i];i++)
{
    int value = s[i] - '0';
//cout<<value<<'*';
    cate_stanga(i,value);
    //cout<<sum<<' ';
    cate_dreapta(i,value);
    //cout<<sum<<' ';
}
cout<<sum;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
const int MOD = 1000000007;
char s[100001];
long long sum;
long long p10[100001];
long long a[100001];
int n;
void cate_stanga(int left,int value)
{
 int combinari= (left * (left+1))/2;
 combinari%=MOD;
 //cout<<"*"<<combinari<<"*";
// cout<<combinari;
 sum+=combinari*p10[n-left-1]*value;
 sum%=MOD;

}
void cate_dreapta(int left,int value)
{

    sum+=value*a[n-left-1];
    sum%=MOD;
}
int main()
{
    int i;
    cin>>s;
     n=strlen(s);
  p10[0]=1;
  for(i=1;i<=n;i++)
    p10[i]=10*p10[i-1],p10[i]%=MOD;
  a[1]=1;
  //cout<<p10[2];
  for(i=2;i<=n;i++)
    a[i]=a[i-1]+p10[i-1]*(i),a[i]%=MOD;

for(i=0;s[i];i++)
{
    int value = s[i] - '0';
//cout<<value<<'*';
    cate_stanga(i,value);
    //cout<<sum<<' ';
    cate_dreapta(i,value);
    //cout<<sum<<' ';
}
cout<<sum;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
const int MOD = 1000000007;
char s[100001];
unsigned long long sum;
long long p10[100001];
long long a[100001];
int n;
void cate_stanga(int left,int value)
{
 unsigned long long  combinari= (left * (left+1))/2;
 combinari%=MOD;
 //cout<<"*"<<combinari<<"*";
// cout<<combinari;
 sum+=combinari*p10[n-left-1]*value;
 sum%=MOD;

}
void cate_dreapta(int left,int value)
{

    sum+=value*a[n-left-1];
    sum%=MOD;
}
int main()
{
    int i;
    cin>>s;
     n=strlen(s);
  p10[0]=1;
  for(i=1;i<=n;i++)
    p10[i]=10*p10[i-1],p10[i]%=MOD;
  a[1]=1;
  //cout<<p10[2];
  for(i=2;i<=n;i++)
    a[i]=a[i-1]+p10[i-1]*(i),a[i]%=MOD;

for(i=0;s[i];i++)
{
    int value = s[i] - '0';
//cout<<value<<'*';
    cate_stanga(i,value);
    //cout<<sum<<' ';
    cate_dreapta(i,value);
    //cout<<sum<<' ';
}
cout<<sum;
    return 0;
}


#include<bits/stdc++.h>
#define I inline
#define ll long long
#define RI register int
#define mo 1000000007
#define N 100005
using namespace std;

int len;ll now,ans,a[N],b[N];
char c[N];

int main(){
	scanf("%s",c+1);len=strlen(c+1);
	RI i;a[0]=b[0]=1;for(i=1;i<=len;i++)a[i]=(a[i-1]*10+1)%mo,b[i]=(b[i-1]*10)%mo;
	for(i=1;i<len;i++)ans=(ans+a[len-i-1]*(now=(now*10+c[i]-'0')%mo)%mo+mo)%mo;now=0;
	for(i=len;i>1;i--)ans=(ans+(i-1)*(now=(now+(c[i]-'0')*(b[len-i]%mo))%mo)%mo)%mo;
	return printf("%lld\n",ans),0;
}


#include<bits/stdc++.h>
#define I inline
#define ll long long
#define RI register int
#define mo 1000000007
#define N 100005
using namespace std;

int len;ll now,ans,a[N],b[N];
char c[N];

int main(){
	scanf("%s",c+1);len=strlen(c+1);
	RI i;a[0]=b[0]=1;for(i=1;i<=len;i++)a[i]=(a[i-1]*10+1)%mo,b[i]=(b[i-1]*10)%mo;
	for(i=1;i<len;i++)ans=(ans+a[len-i-1]*(now=(now*10+c[i]-'0')%mo)%mo+mo)%mo;now=0;
	for(i=len;i>1;i--)ans=(ans+i*(i-1)/2*(c[i]-'0')%mo*b[len-i]+mo)%mo;
	return printf("%lld\n",ans),0;
}


#include<bits/stdc++.h>
#define I inline
#define ll long long
#define RI register int
#define mo 1000000007
#define N 100005
using namespace std;

int len;ll now,ans,a[N],b[N];
char c[N];

int main(){
	scanf("%s",c+1);len=strlen(c+1);
	RI i;a[0]=b[0]=1;for(i=1;i<=len;i++)a[i]=(a[i-1]*10+1)%mo,b[i]=(b[i-1]*10)%mo;
	for(i=1;i<len;i++)ans=(ans+a[len-i-1]*(now=(now*10+c[i]-'0')%mo)%mo+mo)%mo;now=0;
	for(i=len;i>1;i--)ans=(ans+i*(i-1)/2*(c[i]-'0')%mo*b[len-i]%mo)%mo;
	return printf("%lld\n",ans),0;
}


#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long int
#define ll signed long long int
#define pb push_back
#define mpp make_pair
#define mod 1000000007
#define pi 3.1415926536
#define N 100005
#define pp pair<int,int>
#define ms(a,v) memset(a,v,sizeof(a))
#define sortv(a) sort(a.begin(),a.end())
#define range(a,b,c) for(int i=a;i<b;i+=c)
#define inf 10000000000000000
ll fn(ll i)
{
    return (i*(i+1))/2;
}
int main() {

   string a;
   cin>>a;
   int n=a.length();
   ll ans=0,f=1,s=0,nxt=1,ten=1;
   for(ll i=n-1;i>=0;i--)
   {
     ans+=((((ll)(a[i]-48)*f)%mod)*fn(i))%mod+s*(ll)(a[i]-48);
     ans%=mod;
     s=ten*nxt+s;
     s%=mod;
     ten*=10;
     ten%=mod;
     nxt++;
     f*=10;
     f%=mod;
   }
   cout<<ans;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long int
#define ll signed long long int
#define pb push_back
#define mpp make_pair
#define mod 1000000007
#define pi 3.1415926536
#define N 100005
#define pp pair<int,int>
#define ms(a,v) memset(a,v,sizeof(a))
#define sortv(a) sort(a.begin(),a.end())
#define range(a,b,c) for(int i=a;i<b;i+=c)
#define inf 10000000000000000
ll fn(ll i)
{
    return (i*(i+1))/2;
}
int main() {

   string a;
   cin>>a;
   int n=a.length();
   ll ans=0,f=1,s=0,nxt=1,ten=1;
   for(ll i=n-1;i>=0;i--)
   {
     ans+=(a[i]-48)*f*fn(i)+s*(a[i]-48);
     ans%=mod;
     s=ten*nxt+s;
     s%=mod;
     ten*=10;
     ten%=mod;
     nxt++;
     f*=10;
     f%=mod;
   }
   cout<<ans;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long int
#define ll signed long long int
#define pb push_back
#define mpp make_pair
#define mod 1000000007
#define pi 3.1415926536
#define N 100005
#define pp pair<int,int>
#define ms(a,v) memset(a,v,sizeof(a))
#define sortv(a) sort(a.begin(),a.end())
#define range(a,b,c) for(int i=a;i<b;i+=c)
#define inf 10000000000000000
ll fn(ll i)
{
    return (i*(i+1))/2;
}
int main() {

   string a;
   cin>>a;
   int n=a.length();
   ll ans=0,f=1,s=0,nxt=1,ten=1;
   for(ll i=n-1;i>=0;i--)
   {
     ans+=(ll)(a[i]-48)*f*fn(i)+s*(ll)(a[i]-48);
     ans%=mod;
     s=ten*nxt+s;
     s%=mod;
     ten*=10;
     ten%=mod;
     nxt++;
     f*=10;
     f%=mod;
   }
   cout<<ans;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long int
#define ll signed long long int
#define pb push_back
#define mpp make_pair
#define mod 1000000007
#define pi 3.1415926536
#define N 100005
#define pp pair<int,int>
#define ms(a,v) memset(a,v,sizeof(a))
#define sortv(a) sort(a.begin(),a.end())
#define range(a,b,c) for(int i=a;i<b;i+=c)
#define inf 10000000000000000
ll fn(ll i)
{
    return (i*(i+1))/2;
}
int main() {

   string a;
   cin>>a;
   int n=a.length();
   ll ans=0,f=1,s=0,nxt=1,ten=1;
   for(int i=n-1;i>=0;i--)
   {
     ans+=(a[i]-48)*f*fn(i)+s*(a[i]-48);
     ans%=mod;
     s=ten*nxt+s;
     ten*=10;
     ten%=mod;
     nxt++;
     f*=10;
     f%=mod;
   }
   cout<<ans;
  return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>

using namespace std;

#define ll long long
#define pb push_back
#define fi first
#define se second
#define lson(rt) (rt << 1)
#define rson(rt) (rt << 1 | 1)

const ll MOD = 1e9 + 7;
const int N = 1e5 + 10;
ll sum[N], p[N], a[N];
char str[N];

void init()
{
    p[0] = 1;
    for(int i = 1; i < N; ++i){
        p[i] = p[i - 1] * 10 % MOD;
       // if(i < 10)
        //cout << p[i] << endl;
    }

}

inline ll fun(ll x)
{
    return (x) * (x + 1) / 2;
}

void solve()
{
    scanf("%s", str);
    int n;
    n = strlen(str);

    ll sum = 0;
    for(int i = 0; i < n; ++i) {
        a[i + 1] = str[i] - '0';
        sum += a[i + 1];
    }

    init();

    ll ans = 0;
    int inx = 0;
    for(int i = n; i > 1; --i) {
        ans = (fun(i - 1) * a[i] % MOD * p[inx++] % MOD + ans) % MOD;
    }

    for(int i = 1; i < n; ++i) {
        sum -= a[n - i + 1];
        //printf("ans = %lld\n", ans);
        ans = (sum * (ll)i % MOD * p[i - 1] % MOD + ans) % MOD;
    }

    //printf("ans = %lld\n", ans);
    printf("%lld\n", ans);
}

int main(){

    //cout << 99 % 11 * 12 << endl;
    solve();

    return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>

using namespace std;

#define ll long long
#define pb push_back
#define fi first
#define se second
#define lson(rt) (rt << 1)
#define rson(rt) (rt << 1 | 1)

const ll MOD = 1e9 + 7;
const int N = 1e5 + 10;
ll sum[N], p[N], a[N];
char str[N];

void init()
{
    p[0] = 1;
    for(int i = 1; i < N; ++i){
        p[i] = p[i - 1] * 10 % MOD;
       // if(i < 10)
        //cout << p[i] << endl;
    }

}

inline fun(ll x)
{
    return (x) * (x + 1) / 2;
}

void solve()
{
    scanf("%s", str);
    int n;
    n = strlen(str);

    ll sum = 0;
    for(int i = 0; i < n; ++i) {
        a[i + 1] = str[i] - '0';
        sum += a[i + 1];
    }

    init();

    ll ans = 0;
    int inx = 0;
    for(int i = n; i > 1; --i) {
        ans = (fun(i - 1) * a[i] % MOD * p[inx++] % MOD + ans) % MOD;
    }

    for(int i = 1; i < n; ++i) {
        sum -= a[n - i + 1];
        //printf("ans = %lld\n", ans);
        ans = (sum * (ll)i * p[i - 1] % MOD + ans) % MOD;
    }

    //printf("ans = %lld\n", ans);
    printf("%lld\n", ans);
}

int main(){

    //cout << 99 % 11 * 12 << endl;
    solve();

    return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>

using namespace std;

#define ll long long
#define pb push_back
#define fi first
#define se second
#define lson(rt) (rt << 1)
#define rson(rt) (rt << 1 | 1)

const ll MOD = 1e9 + 7;
const int N = 1e5 + 10;
ll sum[N], p[N];
char str[N];
vector<ll > a;

void init()
{
    p[0] = 1;
    sum[0] = 0;
    for(int i = 1; i < N; ++i) p[i] = p[i - 1] * 10 % MOD;
    for(ll i = 1; i < N; ++i) sum[i] = (sum[i - 1] + i * p[i - 1] % MOD) % MOD;
}

inline fun(ll x)
{
    return (x) * (x + 1) / 2;
}

void solve()
{
    init();

    scanf("%s", str);
    for(int i = 0; str[i] != '\0'; ++i) a.pb(str[i] - '0');
    reverse(a.begin(), a.end());

    int n = a.size();
    ll ans = 0;
    for(int i = 0; i < n; ++i) {
        ans = (ans + a[i] * fun(n - i - 1) % MOD * p[i]) % MOD;
        ans = (ans + a[i] * sum[i] % MOD) % MOD;
    }

    //printf("ans = %lld\n", ans);
    printf("%lld\n", ans);
}

int main(){

    //cout << 99 % 11 * 12 << endl;
    solve();

    return 0;
}


# include <iostream>
# include <algorithm>
# include <stdio.h>
# include <string.h>
using namespace std;
int k,a[1000010];
char n[1000010];
int main()
{

	int sum=0;
	cin>>k;
	getchar();
	cin>>n;
	for(int i=0;i<strlen(n);i++)
	{
		a[i]=n[i]-'0';
		sum=sum+(n[i]-'0');
	}
	if(sum>=k) cout<<0;
	else
	{
		k-=sum;
		sort(a,a+strlen(n));
		for(int i=0;i<strlen(n);i++)
		{
			k=k-(9-a[i]);
			if(k<=0)
			{
				cout<<i+1;
				break;
			}
		}
	}
}


# include <iostream>
# include <algorithm>
using namespace std;
int main()
{
	int k;
	string n;
	int sum=0;
	cin>>k>>n;
	for(int i=n.length()-1;i>=0;i--)
	{
		sum=sum+(n[i]-'0');
	}
	if(sum>=k) cout<<0;
	else
	{
		for(int i=n.length()-1;i>=0;i--)
		{
			if(n[i]!='9')
			{
				cout<<n.length()-i;
				break;
			}
		}
	}
}


# include <iostream>
# include <algorithm>
# include <stdio.h>
# include <string.h>
using namespace std;
int main()
{
	int k,a[100010];
	char n[1000010];
	int sum=0,ans=0;
	cin>>k>>n;
	for(int i=0;i<=strlen(n)-1;i++)
	{
		a[i]=n[i]-'0';
		sum=sum+(n[i]-'0');
	}
	if(sum>=k) cout<<0;
	else
	{
		k-=sum;
		sort(a,a+strlen(n)-1);
		for(int i=0;i<strlen(n);i++)
		{
			if(a[i]==9) continue;
			k=k-(9-a[i]);
			ans++;
			if(k<=0)
			{
				cout<<ans;
				break;
			}
		}
	}
}


#include <bits/stdc++.h>
using namespace std;

char s[10005];
int v[10005];

int main() {
    int n, k, su = 0, ncp = 0;
    scanf("%d ", &k);
    gets(s);
    ncp = strlen(s);
    for (int i = 0; i < ncp; i++) {
        v[i + 1] = s[i] - '0';
        su = su + v[i + 1]; }
    sort(v + 1, v + ncp + 1);
    if (su >= k) {
        printf("0\n");
        return 0; }
    for (int i = 1; i <= ncp; i++) {
        if (su + 9 - v[i] >= k) {
            printf("%d", i);
            return 0; }
        su = su + 9 - v[i]; }
    return 0; }


#include <bits/stdc++.h>
using namespace std;

char s[10005];
int v[10005];

int main() {
    int
     k, su = 0, ncp = 0;
    scanf("%d ", &k);
    gets(s);
    ncp = strlen(s);
    for (int i = 0; i < ncp; i++) {
        v[i + 1] = s[i] - '0';
        su = su + v[i + 1];
        if (su >= k) {
            printf("0");
            return 0; } }
    sort(v + 1, v + ncp + 1);
    for (int i = 1; i <= ncp; i++) {
        if (su + 9 - v[i] >= k) {
            printf("%d", i);
            return 0; }
        su = su + 9 - v[i]; }
    return 0; }


#include <bits/stdc++.h>
using namespace std;

char s[100005];
int v[100005];

int main() {
    int
     k, su = 0, ncp = 0;
    scanf("%d ", &k);
    gets(s);
    ncp = strlen(s);
    for (int i = 0; i < ncp; i++) {
        v[i + 1] = s[i] - '0';
        su = su + v[i + 1];
        if (su >= k) {
            printf("0");
            return 0; } }
    sort(v + 1, v + ncp + 1);
    for (int i = 1; i <= ncp; i++) {
        if (su + 9 - v[i] >= k) {
            printf("%d", i);
            return 0; }
        su = su + 9 - v[i]; }
    return 0; }


#include <bits/stdc++.h>
using namespace std;

int v[25];

int main() {
    int n, k, s = 0, ncp = 0;
    scanf("%d %d", &k, &n);
    do {
        s = s + n % 10;
        v[++ncp] = n % 10;
        n = n / 10;
    }while(n);
    sort(v + 1, v + n + 1);
    if (s >= k) {
        printf("0\n");
        return 0; }
    for (int i = 1; i <= ncp; i++) {
        if (s + 9 - v[i] >= k) {
            printf("%d", i);
            return 0; }
        s = s + 9 - v[i]; }
    return 0; }


#include <bits/stdc++.h>
using namespace std;

int v[25];

int main() {
    int n, k, s = 0, ncp = 0;
    scanf("%d %d", &k, &n);
    do {
        s = s + n % 10;
        v[++ncp] = n % 10;
        n = n / 10;
    }while(n);
    sort(v + 1, v + ncp + 1);
    if (s >= k) {
        printf("0\n");
        return 0; }
    for (int i = 1; i <= ncp; i++) {
        if (s + 9 - v[i] >= k) {
            printf("%d", i);
            return 0; }
        s = s + 9 - v[i]; }
    return 0; }


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int k,digit_sum=0;
    string a;
    cin>>k>>a;
    for(int i=0; a[i]; i++)
        digit_sum+=a[i]-'0';
    if(digit_sum>=k)
    {
        cout<<0<<endl;
    }
    else
    {
        int p=9,cn=0;
        for(int i=digit_sum;i<k;i++){
            i+=p;
            if(i>k){
                cn++;
                break;
            }
            cn++;

        }
        cout<<cn<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int k,digit_sum=0;
    string a;
    cin>>k>>a;
    for(int i=0; a[i]; i++)
        digit_sum+=a[i]-'0';
    if(digit_sum>=k)
    {
        cout<<0<<endl;
    }
    else
    {
        int p=9,cn=0;
        for(int i=digit_sum,j=0;;j++){
            i+=p;
            i-=a[j]-48;
            //cout<<i<<" cn "<<cn<<endl;
            if(i>=k){
                cn++;
                break;
            }
            cn++;

        }
        if(cn>digit_sum)
            cn=digit_sum;
        cout<<cn<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int k,digit_sum=0;
    string a;
    cin>>k>>a;
    for(int i=0; a[i]; i++)
        digit_sum+=a[i]-'0';
    if(digit_sum>=k)
    {
        cout<<0<<endl;
    }
    else
    {
        int p=9,cn=0;
        for(int i=digit_sum;;){
            i+=p;
            //cout<<i<<" cn "<<cn<<endl;
            if(i>=k){
                cn++;
                break;
            }
            cn++;

        }
        if(cn>digit_sum)
            cn=digit_sum;
        cout<<cn<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long  int k,digit_sum=0;
    string a;
    cin>>k>>a;
    vector<int>num;
    for(int i=0; a[i]; i++){
        digit_sum+=a[i]-'0';
        num.push_back(a[i]-'0');}

        long long int cn=0;
        sort(num.begin(),num.end());
            for(long long int i=digit_sum,j=0;; j++)
    {
        i-=num[j];
        i+=9;
        if(i>=k)
        {
            cn++;
            break;
        }
        cn++;
    }
    if(digit_sum>=k){
        cn=0;
    }
    cout<<cn<<endl;

return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int k,digit_sum=0;
    string a;
    cin>>k>>a;
    for(int i=0; a[i]; i++)
        digit_sum+=a[i]-'0';
        //cout<<digit_sum<<" Digit_SUm"<<endl;
    if(digit_sum>=k)
    {
        cout<<0<<endl;
    }
    else
    {
        int p=9,cn=0;
        for(int i=digit_sum;i<k;){
            i+=p;
            //cout<<i<<" "<<cn<<endl;
            if(i>k){
                cn++;
                break;
            }
            cn++;

        }
        cout<<cn<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long  int k,digit_sum=0;
    string a;
    cin>>k>>a;
    for(int i=0; a[i]; i++)
        digit_sum+=a[i]-'0';

        long long int cn=0;
    for(long long int i=digit_sum,j=a.length()-1;; j++)
    {
        i-=a[j]-'0';
        i+=9;
        if(i>=k)
        {
            cn++;
            break;
        }
        cn++;
    }
    if(digit_sum>=k){
        cn=0;
    }
    cout<<cn<<endl;

return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int k,digit_sum=0;
    string a;
    cin>>k>>a;
    for(int i=0;a[i];i++)
        digit_sum+=a[i]-'0';
    if(digit_sum>k){
        cout<<0<<endl;
    }
    else{
     cout<<1<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int k,digit_sum=0;
    string a;
    cin>>k>>a;
    for(int i=0; a[i]; i++)
        digit_sum+=a[i]-'0';
        cout<<digit_sum<<" Digit_SUm"<<endl;
    if(digit_sum>=k)
    {
        cout<<0<<endl;
    }
    else
    {
        int p=9,cn=0;
        for(int i=digit_sum;i<k;){
            i+=p;
            cout<<i<<" "<<cn<<endl;
            if(i>k){
                cn++;
                break;
            }
            cn++;

        }
        if(cn>digit_sum)
            cn=digit_sum;
        cout<<cn<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int k,digit_sum=0;
    string a;
    cin>>k>>a;
    for(int i=0; a[i]; i++)
        digit_sum+=a[i]-'0';
    if(digit_sum>k)
    {
        cout<<0<<endl;
    }
    else
    {
        long int cn=0;
        long int v=k-digit_sum;
        long int ans=v/9;
        if(ans==0 || v%9!=0)
        ans+=1;

        cout<<ans<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int k,digit_sum=0;
    string a;
    cin>>k>>a;
    for(int i=0; a[i]; i++)
        digit_sum+=a[i]-'0';
        //cout<<digit_sum<<" Digit_SUm"<<endl;
    if(digit_sum>=k)
    {
        cout<<0<<endl;
    }
    else
    {
        int p=9,cn=0;
        for(int i=digit_sum;i<k;){
            i+=p;
            //cout<<i<<" "<<cn<<endl;
            if(i>k){
                cn++;
                break;
            }
            cn++;

        }
        if(cn>digit_sum)
            cn=digit_sum;
        cout<<cn<<endl;
    }
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>

using namespace std;
int sum(string n){
    char st;
    int numb= 0;
    int sum =0;
    for(int i =0;i<n.length();i++){
        char st = n[i];
        numb = st - '0';

        sum += numb;
    }
        return sum;
}
int main(){

    int a[4];
    int ans=0;
    int s;
    int k;

    string n;
    cin >> k >> n;

    if(sum(n) >= k) cout << "0"<< endl;
    else {
        for(int j = 1;j<=n.length();j++){

        n[n.length()-j] = '9';
            // cout<<"A  " << n;
            // cout<< "B  "<< sum(n);
        if(sum(n) >= k){
            // cout<<"asgasgs";
            cout << j << endl;
            break;
        }

        }
    }

    // cout << sum("12345");

}


#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>

using namespace std;

int mins(string n){

        int len = n.length();
        char ch;
        int numb=0;
        int arr[1000];
        for(int i=0;i<len;i++){

            ch = n[i];
            numb = ch - '0';
            arr[i] = numb;
        }

        int elem = *min_element(arr,arr+len);

        return elem;

    }

int sum(string n){

    char st;
    int numb= 0;
    int sum =0;
    for(int i =0;i<n.length();i++){
        char st = n[i];
        numb = st - '0';

        sum += numb;
    }
        return sum;
}

int main(){

    int a[4];
    int ans=0;
    int s;
    string n;
    int k;
    int len = n.length();
    cin >> k >> n;
    string newstr = n;
    if(sum(n) >= k) cout << "0"<< endl;
    else {
        int len = newstr.length();
        // cout<< "ASGAS"<<endl;
        for(int j = 1;j<=len;j++){

            int elem = mins(n);
            // cout << elem<<endl;
            // cout << len << endl;

            for(int z = 0;z < len;z++){
                int currn =  (n[z] -'0');
                // cout<< currn <<endl;
                if(currn == elem) {
                    n[z] = '9';
                    // cout<<"Z " << z<<endl;
                    break;
                    // cout<<n[z]<<endl;
                }
            }
        // n[len-j] = '9';
            //  cout<<"SUM "<< sum(n)<<endl;
        if(sum(n) >= k){

            cout << j << endl;
            break;
        }

        }
    }

    // cout << sum("12345");

}


#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <algorithm>

using namespace std;
int x=0;
int mins(string n){

        int len = n.length();
        char ch;
        int numb=0;
        int arr[1000];
        for(int i=0;i<len;i++){

            ch = n[i];
            numb = ch - '0';
            arr[i] = numb;
        }

        int elem = *min_element(arr,arr+len);
        x = distance(arr, find(arr, arr + len, elem));
        return elem;

    }

int sum(string n){

    char st;
    int numb= 0;
    int sum =0;
    for(int i =0;i<n.length();i++){
        char st = n[i];
        numb = st - '0';

        sum += numb;
    }
        return sum;
}

int main(){

    int a[4];
    int ans=0;
    int s;
    string n;
    int k;
    int len = n.length();
    cin >> k >> n;
    string newstr = n;
    if(sum(n) >= k) cout << "0"<< endl;
    else {
        int len = newstr.length();
        // cout<< "ASGAS"<<endl;
        for(int j = 1;j<=len;j++){

            int elem = mins(n);
            n[x] = '9';
            // cout<< x<<endl;
            // cout << elem<<endl;
            // cout << len << endl;

            // for(int z = 0;z < len;z++){
            //     int currn =  (n[z] -'0');
            //     // cout<< currn <<endl;
            //     if(currn == elem) {
            //         n[z] = '9';
            //         // cout<<"Z " << z<<endl;
            //         break;
            //         // cout<<n[z]<<endl;
            //     }
            // }
        // n[len-j] = '9';
            //  cout<<"SUM "<< sum(n)<<endl;
            // cout<<n<<endl;
            // cout<<sum(n)<<endl;
        if(sum(n) >= k){

            cout << j << endl;
            break;
        }

        }
    }

    // cout << sum("12345");

}


#include <string>
#include <functional>
#include <queue>
#include <vector>
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>

using namespace std;

int main(){

    int k;
    string s;
    cin >> k >> s;
    int count =0;

    int sum=0;
    int curr=0;

    int arr[10];

    for(int i=0;i<10;i++){
        arr[i]=0;

    }
    for(int i = 0;i < s.size();i++){
        arr[s[i] - '0']++;
        sum += s[i] -'0';
    }
    if(sum>=k)cout<< "0";
    else{
        while(sum < k){
            if(arr[curr] == 0)curr++;
            else{
                sum += 9 - curr;
                arr[curr]--;
                count++;
            }
        }
        cout<<count;
    }

    }


#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <algorithm>

using namespace std;

int mins(string n){

        int len = n.length();
        char ch;
        int numb=0;
        int arr[1000];
        for(int i=0;i<len;i++){

            ch = n[i];
            numb = ch - '0';
            arr[i] = numb;
        }

        int elem = *min_element(arr,arr+len);

        return elem;

    }

int sum(string n){

    char st;
    int numb= 0;
    int sum =0;
    for(int i =0;i<n.length();i++){
        char st = n[i];
        numb = st - '0';

        sum += numb;
    }
        return sum;
}

int main(){

    int a[4];
    int ans=0;
    int s;
    string n;
    int k;
    int len = n.length();
    cin >> k >> n;
    string newstr = n;
    if(sum(n) >= k) cout << "0"<< endl;
    else {
        int len = newstr.length();
        // cout<< "ASGAS"<<endl;
        for(int j = 1;j<=len;j++){

            int elem = mins(n);
            // cout << elem<<endl;
            // cout << len << endl;

            for(int z = 0;z < len;z++){
                int currn =  (n[z] -'0');
                // cout<< currn <<endl;
                if(currn == elem) {
                    n[z] = '9';
                    // cout<<"Z " << z<<endl;
                    break;
                    // cout<<n[z]<<endl;
                }
            }
        // n[len-j] = '9';
            //  cout<<"SUM "<< sum(n)<<endl;
        if(sum(n) >= k){

            cout << j << endl;
            break;
        }

        }
    }

    // cout << sum("12345");

}


#include <string>
#include <functional>
#include <queue>
#include <vector>
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>

using namespace std;

priority_queue<int, std::vector<int>, std::greater<int> > pq1;

template<typename T> int sum(T pq){
    int sum =0;

    while( pq.size() > 0) {
        sum+= pq.top();
        // cout << "size = " << pq.size() << endl;
        // cout << "element " << pq.top() << endl;
        pq.pop();
    }

    // pq=pq1;
    return sum;

}
int main(){

    int k;

    int f=0;

    string n;
    cin >> k >> n;

    int num=0;
    int len = n.length();

    priority_queue<int, vector<int>, greater<int> > pq;

    // for(int i=0;i<len;i++){ // priority queue zapolnenie
    //     num = n[i]-'0';

    //     pq.push(num);
    // }
    for(int i =0;i<len;i++){
        char st = n[i];
        num = st - '0';

        pq.push(num);
    }
    pq1=pq;

        if (sum(pq) >= k ) {
            cout << '0'<<endl;
        } else {
            int count=0;

            while ( sum(pq) < k){

                pq.pop();
                pq.push(9);
                // pq1=pq;
                count++;

            }
            cout<<count<<endl;
        }

    }


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

int k,a[15],n=1,sum=0;

void read(){
	char ch;
	while((ch=getchar())<'0'||ch>'9');
	a[n]=ch-'0';
	while((ch=getchar())>='0'&&ch<='9')  a[++n]=ch-'0',sum+=ch-'0';
}

int main(){
	scanf("%d",&k);  read();
	sort(a+1,a+n+1);
	a[0]=9;
	for(int i=0;i<=n;i++){
		sum+=9-a[i];
		if(sum>=k){
			printf("%d\n",i);
			return 0;
		}
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int maxn=100005;

int k,a[15],n=1,sum=0;

void read(){
	char ch;
	while((ch=getchar())<'0'||ch>'9');
	a[n]=ch-'0';
	while((ch=getchar())>='0'&&ch<='9')  a[++n]=ch-'0',sum+=ch-'0';
}

int main(){
	scanf("%d",&k);  read();
	sort(a+1,a+n+1);
	a[0]=9;
	for(int i=0;i<=n;i++){
		sum+=9-a[i];
		if(sum>=k){
			printf("%d\n",i);
			return 0;
		}
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int maxn=100005;

int k,a[maxn],n=1,sum=0;

void read(){
	char ch;
	while((ch=getchar())<'0'||ch>'9');
	a[n]=ch-'0';
	while((ch=getchar())>='0'&&ch<='9')  a[++n]=ch-'0',sum+=ch-'0';
}

int main(){
	scanf("%d",&k);  read();
	sort(a+1,a+n+1);
	a[0]=9;
	for(int i=0;i<=n;i++){
		sum+=9-a[i];
		if(sum>=k){
			printf("%d\n",i);
			return 0;
		}
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define dbg(x) cout<<#x<<" = "<<x<<endl
using namespace std;

const int maxn=100005;

int k,a[maxn],n=1,sum;

void read(){
	char ch;
	while((ch=getchar())<'0'||ch>'9');
	a[n]=ch-'0';
	sum=ch-'0';
	while((ch=getchar())>='0'&&ch<='9')  a[++n]=ch-'0',sum+=ch-'0';
}

int main(){
	scanf("%d",&k);  read();
	sort(a+1,a+n+1);
	a[0]=9;
	dbg(n);
	for(int i=0;i<=n;i++){
		sum+=9-a[i];
		if(sum>=k){
			printf("%d\n",i);
			return 0;
		}
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define dbg(x) cout<<#x<<" = "<<x<<endl
using namespace std;

const int maxn=100005;

int k,a[maxn],n=1;

void read(){
	char ch;
	while((ch=getchar())<'0'||ch>'9');
	a[n]=ch-'0';
	sum=ch-'0';
	while((ch=getchar())>='0'&&ch<='9')  a[++n]=ch-'0',sum+=ch-'0';
}

int main(){
	scanf("%d",&k);  read();
	sort(a+1,a+n+1);
	a[0]=9;
	dbg(n);
	for(int i=0;i<=n;i++){
		sum+=9-a[i];
		if(sum>=k){
			printf("%d\n",i);
			return 0;
		}
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define dbg(x) cout<<#x<<" = "<<x<<endl
using namespace std;

const int maxn=100005;

int k,a[maxn],n=1,sum;

void read(){
	char ch;
	while((ch=getchar())<'0'||ch>'9');
	a[n]=ch-'0';
	sum=ch-'0';
	while((ch=getchar())>='0'&&ch<='9')  a[++n]=ch-'0',sum+=ch-'0';
}

int main(){
	scanf("%d",&k);  read();
	sort(a+1,a+n+1);
	a[0]=9;
//	dbg(n);
	for(int i=0;i<=n;i++){
		sum+=9-a[i];
		if(sum>=k){
			printf("%d\n",i);
			return 0;
		}
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define ms(i, j) memset(i, j, sizeof i)
#define LL long long
#define db double
const int MAXN = 100000 + 5;
char s[MAXN];
int k, len, tot, tot9;
void clean() {
	tot = tot9 = 0;
}
void solve() {
	clean();
	scanf("%s", s);
	len = strlen(s);
	for (int i=0;i<len;i++) {
		tot += s[i] - '0';
		if (s[i] == '9') tot9++;
	}
	if (tot >= k) printf("0\n"); else {
		int ans = k / 9 - tot9;
		if (ans == 0) ans = 1;
		printf("%d\n", ans);
	}
}
int main() {
	scanf("%d", &k), solve();
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ms(i, j) memset(i, j, sizeof i)
#define LL long long
#define db double
using namespace std;
const int MAXN = 35000 + 5;
int k, a[100000 + 5];
char s[100000 + 5];
void clean() {
}
void solve() {
	clean();
	scanf("%s", s + 1);
	int n = strlen(s + 1), tot = 0;
	for (int i = 1; i <= n; i++) tot += (a[i] = s[i] - '0');
	if (tot >= k) {printf("%d\n", 0); return ;}
	sort(a + 1, a + 1 + n);
	int cur = 0;
	for (int i = 1; i <= n; i++) {
		cur += 9 - a[i];
		if (cur >= k - tot) {printf("%d\n", i); return ;}
	}
}
int main() {
	scanf("%d", &k), solve();
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ms(i, j) memset(i, j, sizeof i)
#define LL long long
#define db double
using namespace std;
const int MAXN = 35000 + 5;
int k, a[100000 + 5];
char s[100000 + 5];
void clean() {
}
void solve() {
	clean();
	scanf("%s", s + 1);
	int n = strlen(s + 1), tot = 0;
	for (int i = 1; i <= n; i++) tot += (a[i] = s[i] - '0');
	if (tot >= k) {printf("%d\n", 0); return ;}
	sort(a + 1, a + 1 + n);
	int cur = 0;
	for (int i = 1; i <= n; i++) {
		cur += 9 - a[i];
		if (cur >= k) {printf("%d\n", i); return ;}
	}
}
int main() {
	scanf("%d", &k), solve();
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define ms(i, j) memset(i, j, sizeof i)
#define LL long long
#define db double
const int MAXN = 100000 + 5;
char s[MAXN];
int k, len, tot;
void clean() {
	tot = 0;
}
void solve() {
	clean();
	scanf("%s", s);
	len = strlen(s);
	for (int i=0;i<len;i++) tot += s[i] - '0';
	if (tot >= k) printf("0\n"); else printf("1\n");
}
int main() {
	scanf("%d", &k), solve();
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define ms(i, j) memset(i, j, sizeof i)
#define LL long long
#define db double
const int MAXN = 100000 + 5;
char s[MAXN];
int k, len, tot, tot9;
void clean() {
	tot = tot9 = 0;
}
void solve() {
	clean();
	scanf("%s", s);
	len = strlen(s);
	for (int i=0;i<len;i++) {
		tot += s[i] - '0';
		if (s[i] == '9') tot9++;
	}
	if (tot >= k) printf("0\n"); else {
		int ans = k / 9 - tot9;
		printf("%d\n", ans);
	}
}
int main() {
	scanf("%d", &k), solve();
	return 0;
}