#include <bits/stdc++.h>
using namespace std;
struct Node {
long long ways;
long long cnt[10];
};
struct DigitDP {
// dp[pos][tight][started]
Node memo[20][2][2];
char vis[20][2][2];
string s;
int nlen;
int targetParity;
static Node zeroNode() {
Node t; t.ways = 0;
for (int i = 0; i < 10; ++i) t.cnt[i] = 0;
return t;
}
static Node addNode(const Node& a, const Node& b) {
Node r; r.ways = a.ways + b.ways;
for (int d = 0; d < 10; ++d) r.cnt[d] = a.cnt[d] + b.cnt[d];
return r;
}
Node dfs(int pos, int tight, int started) {
if (pos == nlen) {
Node base = zeroNode();
base.ways = 1; // đã hình thành 1 số
return base;
}
if (vis[pos][tight][started]) return memo[pos][tight][started];
vis[pos][tight][started] = 1;
Node res = zeroNode();
int lim = tight ? (s[pos] - '0') : 9;
int lastPos = (pos == nlen - 1);
for (int d = 0; d <= lim; ++d) {
int ntight = tight && (d == lim);
int nstarted = started || (d != 0);
// Ràng buộc chẵn/lẻ ở chữ số cuối
if (lastPos) {
if (!nstarted) {
// số là 0
if ((0 % 2) != targetParity) continue;
} else {
if ((d % 2) != targetParity) continue;
}
}
Node child = dfs(pos + 1, ntight, nstarted);
// Ghi nhận đóng góp của chữ số tại vị trí này
if (nstarted) {
// đã bắt đầu, d thật sự xuất hiện
if (child.ways != 0) child.cnt[d] += child.ways;
} else if (lastPos) {
// số 0 (chưa từng start) -> có một chữ số '0'
if (child.ways != 0) child.cnt[0] += child.ways;
}
res = addNode(res, child);
}
memo[pos][tight][started] = res;
return res;
}
// Đếm số lần xuất hiện mỗi chữ số trong các số <= bound
// mà chữ số cuối cùng có parity = targetParity
void solve(long long bound, int parity, long long outCnt[10]) {
for (int d = 0; d < 10; ++d) outCnt[d] = 0;
if (bound < 0) return; // rỗng
targetParity = parity & 1;
s = to_string(bound);
nlen = (int)s.size();
memset(vis, 0, sizeof(vis));
Node ans = dfs(0, 1, 0);
for (int d = 0; d < 10; ++d) outCnt[d] = ans.cnt[d];
}
};
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
long long k, n;
if (!(cin >> k >> n)) return 0;
if (n <= 0) {
for (int d = 0; d < 10; ++d) {
cout << 0 << (d == 9 ? '\n' : ' ');
}
return 0;
}
long long L = k;
long long R;// R = k + 2*(n-1) (cẩn thận tràn nhưng theo đề chỉ dùng long long)
R = k + 2 * (n - 1);
if (L > R) swap(L, R);
DigitDP dp;
int parity = ((k % 2) + 2) % 2;
long long cntR[10], cntLm2[10], ans[10];
dp.solve(R, parity, cntR);
long long cntTmp[10] = {0};
if (L - 2 >= 0) {
dp.solve(L - 2, parity, cntLm2);
} else {
for (int d = 0; d < 10; ++d) cntLm2[d] = 0;
}
for (int d = 0; d < 10; ++d) {
long long v = cntR[d] - cntLm2[d];
ans[d] = v;
}
for (int d = 0; d < 10; ++d) {
cout << ans[d] << (d == 9 ? '\n' : ' ');
}
return 0;
}