#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<bool> vbl;
typedef vector<vector<bool>> vvbl;

void INX(){}
template<typename Head, typename... Tail>
void INX(Head&& head, Tail&&... tail)
{
    cin >> head;
    INX(forward<Tail>(tail)...);
}
void OUTX(){}
template<typename Head, typename... Tail>
void OUTX(Head&& head, Tail&&... tail)
{
    cout << head << endl;
    OUTX(forward<Tail>(tail)...);
}
void OUTX2(){cout << endl;}
template<typename Head, typename... Tail>
void OUTX2(Head&& head, Tail&&... tail)
{
    cout << head << ' ';
    OUTX2(forward<Tail>(tail)...);
}

#define ADD emplace_back
#define MP make_pair
#define __LONG_LONG_MIN__ (-__LONG_LONG_MAX__ - 1)

//#define MOD 1000000007 // 10^9 + 7
//setprecision(10)

ll abmodn(ll a, ll b, ll n)
{
    if(n == 1) return 0;
    if(b == 0) return 1;
    if(a % n == 0) return 0;

    vbl chk(n, false);
    vll v;
    ll m = a;
    ll loop = 0;
    for (; loop <= n; loop++)
    {
        m %= n;
        if(chk[m]) break;
        chk[m] = true;
        v.ADD(m);
        m *= a;
    }
    
    ll startloop = 0;
    while(v[startloop] != m) startloop++;
    ll looplen = loop - startloop;

    b--;
    if(b > startloop)
    {
        b -= startloop;
        b %= looplen;
        b += startloop;
    }
    return v[b];
}

int main()
{
    ll N, M;
    INX(N, M);

    ll M2 = M * M;
    ll n10modm = abmodn(10, N, M2);
    ll result = (n10modm / M) % M;
    OUTX(result);

    return 0;
}

#include<bits/stdc++.h>
#define int long long 
using namespace std;
typedef long long ll;
const int N=100050;
int a[N],b[N],c[N];
int n,m,k;
int ans;
bool check(int x)
{
	int l=0,r=0;
	for(int i=1;i<=k;i++)
	{
		l+=(m*a[i]-x+n-1)/n;
		r+=(m*a[i]+x)/n;
	}
	if(l<=m&&m<=r) return true;
	else return false;
}
void construct()
{
	int sum=0;
	for(int i=1;i<=k;i++)
	{
		b[i]=(m*a[i]-ans+n-1)/n;
		sum+=b[i];
		c[i]=(m*a[i]+ans)/n;
	}
	for(int i=1;i<=k;i++)
	{
		int temp=min(m-sum,c[i]-b[i]);
		b[i]+=temp;
		sum+=temp;
	}

}
signed  main()
{
	cin>>k>>n>>m;
	for(int i=1;i<=k;i++) cin>>a[i];
	int l=-1,r=n*m;
	while(r-l>1)
	{
		int mid=(r+l)>>1;
		if(check(mid)) r=mid;
		else l=mid;	
	}
	ans=r;
	
	construct();
	for(int i=1;i<=k;i++) cout<<b[i]<<" ";
	
}