/**
 *  Author: houtaruijika
 *  Created: 2018.10.26 01:58:06
 */

#include <bits/stdc++.h>

using namespace std;

#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define FORD(i, b, a) for (int i = b; i >= a; --i)

#define sz(v) (int) v.size()
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())

#define DEBUG(x) cerr << #x << " = " << x << endl;
#define DEBUGS(v, a, b) cerr << #v << " = "; FOR(i, a, b) cerr << v[i] << " "; cerr << endl;

const int MOD = 998244353;

long long f[22][1 << 10][2][2];

void add(long long &x, long long y) { x = (x + y % MOD) % MOD; }

long long solve(string s, long long k) {
    memset(f, 0, sizeof f);
    f[0][0][1][0] = 1;
    REP(i, sz(s)) REP(x, 1 << 10) REP(y, 2) REP(dg, 10) {
        if (dg > s[i] - '0' && y) continue;
        add(f[i + 1][x | 1 << dg][y && dg == s[i] - '0'][0], f[i][x][y][0]);
        add(f[i + 1][x | 1 << dg][y && dg == s[i] - '0'][1], 10 * f[i][x][y][1] + dg * f[i][x][y][0]);
    }
    long long answer = 0;
    REP(x, 1 << 10) REP(y, 2) if (__builtin_popcount(x) <= k) {
        add(answer, f[sz(s)][x][y][1]);
    }
    return answer;
}

int main() {
    long long l, r, k;
    while (cin >> l >> r >> k) {
        cout << (solve(to_string(r), k) - solve(to_string(l - 1), k) + MOD) % MOD << "\n";
    }
    return 0;
}


/**
 *  Author: houtaruijika
 *  Created: 2018.10.26 02:14:08
 */

#include <bits/stdc++.h>

using namespace std;

#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define FORD(i, b, a) for (int i = b; i >= a; --i)

#define sz(v) (int) v.size()
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())

#define DEBUG(x) cerr << #x << " = " << x << endl;
#define DEBUGS(v, a, b) cerr << #v << " = "; FOR(i, a, b) cerr << v[i] << " "; cerr << endl;

const int MOD = 998244353;

long long f[22][1 << 10][2][2];

void add(long long &x, long long y) { x = (x + y % MOD) % MOD; }

long long solve(string s, int k) {
    memset(f, 0, sizeof f);
    f[0][0][1][0] = 1;
    REP(i, sz(s)) REP(x, 1 << 10) REP(y, 2) REP(dg, 10) {
        if (y && dg > s[i] - '0') continue;
        int newx = (x == 1 ? 0 : x) | 1 << dg;
        int newy = y && dg == s[i] - '0';
        add(f[i + 1][newx][newy][0], f[i][x][y][0]);
        add(f[i + 1][newx][newy][1], 10 * f[i][x][y][1] + dg * f[i][x][y][0]);
    }
    long long answer = 0;
    REP(x, 1 << 10) REP(y, 2) if (__builtin_popcount(x) <= k) {
        add(answer, f[sz(s)][x][y][1]);
    }
    return answer;
}

int main() {
    long long l, r, k;
    while (cin >> l >> r >> k) {
        cout << (solve(to_string(r), k) - solve(to_string(l - 1), k) + MOD) % MOD << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename H, typename... T> void debug_out(H h, T... t) {
  cerr << " " << (h);
  debug_out(t...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

const long long mod = 998244353;

int k;
long long mp[20];
long long dp[20][(1 << 10) + 1][2][2];
long long dp_ans[20][(1 << 10) + 1][2][2];

typedef long long ll;

pair<ll, ll> go(string &s, int idx, int mask, int top, int first) {
  if (idx == int(s.size())) return {__builtin_popcount(mask) <= k, 0};
  int mmax = top ? s[idx] - '0' : 9;

 if (dp[idx][mask][top][first] != -1) {
    return {dp[idx][mask][top][first], dp_ans[idx][mask][top][first]};
  }

  long long acc = 0;
  long long acc_ans = 0;
  for (int d = 0; d <= mmax; d++) {
    int nmask = mask;
    if ((d != 0) || first)
      nmask |= (1 << d);

    auto tmp = go(s, idx + 1, nmask, top && (d == mmax), first || (d != 0));
    auto times = tmp.first;
    long long right = (mp[s.size()-1-idx] * d) % mod;
    right = (right * times) % mod;
    acc_ans = (acc_ans + right + tmp.second) % mod;
    acc += times;
  }
  dp_ans[idx][mask][top][first] = acc_ans;
  dp[idx][mask][top][first] = acc;
  return {acc, acc_ans};
}

int main() {
#ifndef LOCAL
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#define endl '\n'
#endif

  mp[0] = 1;
  for (int i = 1; i < 19; i++) {
    mp[i] = mp[i-1] * 10LL;
    mp[i] %= mod;
  }

  long long a, b;
  cin >> a >> b >> k;

  string s = to_string(b);
  memset(dp, -1, sizeof dp);
  auto tmp = go(s, 0, 0, true, false);
  long long ans1 = tmp.second;
  if (a) a--;
  s = to_string(a);
  memset(dp, -1, sizeof dp);
  tmp = go(s, 0, 0, true, false);
  cout << (ans1 - tmp.second + mod) % mod << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename H, typename... T> void debug_out(H h, T... t) {
  cerr << " " << (h);
  debug_out(t...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

const long long mod = 998244353;

int k;
long long mp[22];
long long dp[20][(1 << 10) + 1][2][2];
long long dp_ans[20][(1 << 10) + 1][2][2];

typedef long long ll;

pair<ll, ll> go(string &s, int idx, const int mask, int top, int first) {
  if (idx == int(s.size())) return {__builtin_popcount(mask) <= k, 0};
  int mmax = top ? s[idx] - '0' : 9;

 if (dp[idx][mask][top][first] != -1) {
    return {dp[idx][mask][top][first], dp_ans[idx][mask][top][first]};
  }

  long long acc = 0;
  long long acc_ans = 0;
  for (int d = 0; d <= mmax; d++) {
    int nmask = mask;
    if ((d != 0) || first) nmask |= (1 << d);

    auto tmp = go(s, idx + 1, nmask, top && (d == mmax), first || (d != 0));

    auto times = tmp.first % mod;
    long long right = (mp[s.size()-1-idx] * d) % mod;
    right = (right * times) % mod;
    assert(right >= 0);

    acc_ans = (acc_ans + right) % mod;
    acc_ans = (acc_ans + tmp.second) % mod;

    acc += times;
  }

  dp[idx][mask][top][first] = acc;
  dp_ans[idx][mask][top][first] = acc_ans % mod;
  return {acc, acc_ans};
}

int main() {
#ifndef LOCAL
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#define endl '\n'
#endif

  mp[0] = 1;
  for (int i = 1; i < 22; i++) {
    mp[i] = mp[i-1] * 10LL;
    mp[i] %= mod;
  }

  long long a, b;
  cin >> a >> b >> k;

  string s = to_string(b);
  memset(dp, -1, sizeof dp);
  auto tmp = go(s, 0, 0, true, false);
  long long ans1 = tmp.second % mod;
  if (a) a--;
  s = to_string(a);
  memset(dp, -1, sizeof dp);
  tmp = go(s, 0, 0, true, false);
  cout << (ans1 - tmp.second + mod) % mod << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename H, typename... T> void debug_out(H h, T... t) {
  cerr << " " << (h);
  debug_out(t...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

const long long mod = 998244353;

int k;
long long mp[20];
long long dp[19][(1 << 10) + 1][2][2];
long long dp_ans[19][(1 << 10) + 1][2][2];

typedef long long ll;

pair<ll, ll> go(string &s, int idx, int mask, int top, int first) {
  if (idx == int(s.size())) return {__builtin_popcount(mask) <= k, 0};
  int mmax = top ? s[idx] - '0' : 9;

 if (dp[idx][mask][top][first] != -1) {
    return {dp[idx][mask][top][first], dp_ans[idx][mask][top][first]};
  }

  long long acc = 0;
  long long acc_ans = 0;
  for (int d = 0; d <= mmax; d++) {
    int nmask = mask;
    if (d != 0 || first)
      nmask |= (1 << d);

    auto tmp = go(s, idx + 1, nmask, top && (d == mmax), first || d != 0);
    auto times = tmp.first;
    long long right = (mp[s.size()-1-idx] * d) % mod;
    right = (right * times) % mod;
    acc_ans = (acc_ans + right + tmp.second) % mod;
    acc += times;
  }
  dp_ans[idx][mask][top][first] = acc_ans;
  dp[idx][mask][top][first] = acc;
  return {acc, acc_ans};
}

int main() {
#ifndef LOCAL
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#define endl '\n'
#endif

  mp[0] = 1;
  for (int i = 1; i < 19; i++) {
    mp[i] = mp[i-1] * 10LL;
    mp[i] %= mod;
  }

  long long a, b;
  cin >> a >> b >> k;

  string s = to_string(b);
  memset(dp, -1, sizeof dp);
  auto tmp = go(s, 0, 0, true, false);
  long long ans1 = tmp.second;
  if (a) a--;
  s = to_string(a);
  memset(dp, -1, sizeof dp);
  tmp = go(s, 0, 0, true, false);
  cout << (ans1 - tmp.second + mod) % mod << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename H, typename... T> void debug_out(H h, T... t) {
  cerr << " " << (h);
  debug_out(t...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

const long long mod = 998244353;

int k;
long long mp[22];
long long dp[20][(1 << 10) + 1][2][2];
long long dp_ans[20][(1 << 10) + 1][2][2];

typedef long long ll;

pair<ll, ll> go(string &s, int idx, const int mask, int top, int first) {
  if (idx == int(s.size())) return {__builtin_popcount(mask) <= k, 0};
  int mmax = top ? s[idx] - '0' : 9;

 if (dp[idx][mask][top][first] != -1) {
    return {dp[idx][mask][top][first], dp_ans[idx][mask][top][first]};
  }

  long long acc = 0;
  long long acc_ans = 0;
  for (int d = 0; d <= mmax; d++) {
    int nmask = mask;
    if ((d != 0) || first) nmask |= (1 << d);

    auto tmp = go(s, idx + 1, nmask, top && (d == mmax), first || (d != 0));

    auto times = tmp.first;
    long long right = (mp[s.size()-1-idx] * d) % mod;
    right = (right * times) % mod;
    acc_ans = (((acc_ans + right) % mod) + tmp.second) % mod;

    acc += times;
  }

  dp[idx][mask][top][first] = acc;
  dp_ans[idx][mask][top][first] = acc_ans % mod;
  return {acc, acc_ans};
}

int main() {
#ifndef LOCAL
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#define endl '\n'
#endif

  mp[0] = 1;
  for (int i = 1; i < 22; i++) {
    mp[i] = mp[i-1] * 10LL;
    mp[i] %= mod;
  }

  long long a, b;
  cin >> a >> b >> k;

  string s = to_string(b);
  memset(dp, -1, sizeof dp);
  auto tmp = go(s, 0, 0, true, false);
  long long ans1 = tmp.second % mod;
  if (a) a--;
  s = to_string(a);
  memset(dp, -1, sizeof dp);
  tmp = go(s, 0, 0, true, false);
  cout << (ans1 - tmp.second + mod) % mod << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename H, typename... T> void debug_out(H h, T... t) {
  cerr << " " << (h);
  debug_out(t...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

const long long mod = 998244353;

int k;
long long mp[22];
long long dp[20][(1 << 10) + 1][2][2];
long long dp_ans[20][(1 << 10) + 1][2][2];

typedef long long ll;

pair<ll, ll> go(string &s, int idx, int mask, int top, int first) {
  if (idx == int(s.size())) return {__builtin_popcount(mask) <= k, 0};
  int mmax = top ? s[idx] - '0' : 9;

 if (dp[idx][mask][top][first] != -1) {
    return {dp[idx][mask][top][first], dp_ans[idx][mask][top][first]};
  }

  long long acc = 0;
  long long acc_ans = 0;
  for (int d = 0; d <= mmax; d++) {
    int nmask = mask;
    if ((d != 0) || first)
      nmask |= (1 << d);

    auto tmp = go(s, idx + 1, nmask, top && (d == mmax), first || (d != 0));
    auto times = tmp.first;
    long long right = (mp[s.size()-1-idx] * d) % mod;
    right = (right * times) % mod;
    acc_ans = (acc_ans + right + tmp.second) % mod;
    acc += times;
  }
  dp_ans[idx][mask][top][first] = acc_ans;
  dp[idx][mask][top][first] = acc;
  return {acc, acc_ans};
}

int main() {
#ifndef LOCAL
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#define endl '\n'
#endif

  mp[0] = 1;
  for (int i = 1; i < 22; i++) {
    mp[i] = mp[i-1] * 10LL;
    mp[i] %= mod;
  }

  long long a, b;
  cin >> a >> b >> k;

  string s = to_string(b);
  memset(dp, -1, sizeof dp);
  auto tmp = go(s, 0, 0, true, false);
  long long ans1 = tmp.second;
  if (a) a--;
  s = to_string(a);
  memset(dp, -1, sizeof dp);
  tmp = go(s, 0, 0, true, false);
  cout << (ans1 - tmp.second + mod) % mod << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename H, typename... T> void debug_out(H h, T... t) {
  cerr << " " << (h);
  debug_out(t...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

const long long mod = 998244353;

int k;
long long mp[20];
long long ans;

long long dp[19][(1 << 10) + 1][2];
long long dp_ans[19][(1 << 10) + 1][2];

typedef long long ll;

pair<ll, ll> go(string &s, int idx, int mask, int top) {
  if (idx == int(s.size())) return {__builtin_popcount(mask) <= k, 0};
  int mmax = top ? s[idx] - '0' : 9;

 if (dp[idx][mask][top] != -1) {
    return {dp[idx][mask][top], dp_ans[idx][mask][top]};
  }

  long long acc = 0;
  long long acc_ans = 0;
  for (int d = 0; d <= mmax; d++) {
    auto tmp = go(s, idx + 1, mask | (1 << d), top && (d == mmax));
    auto times = tmp.first;
    long long right = (mp[s.size() - 1 - idx] * d) % mod;
    right = (right * times) % mod;
    acc_ans = (acc_ans + right + tmp.second) % mod;
    acc += times;
  }
  dp_ans[idx][mask][top] = acc_ans;
  dp[idx][mask][top] = acc;
  return {acc, acc_ans};
}

int main() {
#ifndef LOCAL
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#define endl '\n'
#endif

  mp[0] = 1;
  for (int i = 1; i < 19; i++) {
    mp[i] = mp[i-1] * 10LL;
    mp[i] %= mod;
  }

  long long a, b;
  cin >> a >> b >> k;

  ans = 0;
  string s = to_string(b);
  memset(dp, -1, sizeof dp);
  auto tmp = go(s, 0, 0, true);
  long long ans1 = tmp.second;
  ans = 0;
  if (a) a--;
  s = to_string(a);
  memset(dp, -1, sizeof dp);
  tmp = go(s, 0, 0, true);
  cout << (ans1 - tmp.second + mod) % mod << endl;
  return 0;
}


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

const int MOD = 998244353;
const pair<int, int> INF = {INT_MAX, INT_MAX};

vector<int> convert(const auto &N) {
	vector<int> ans;
	for (auto i = N; i > 0; i /= 10)
		ans.push_back(i % 10);
	reverse(ans.begin(), ans.end());
	return ans;
}

vector< vector< vector< pair<int, int> > > > create_dp() {
	vector< vector< vector< pair<int, int> > > > dp;
	dp.resize(21);
	for (int i = 0; i < int(dp.size()); ++i) {
		dp[i].resize(2);
		for (int j = 0; j < int(dp[i].size()); ++j)
			dp[i][j].resize(1 << 11);
	}
	for (int i = 0; i < int(dp.size()); ++i)
		for (int j = 0; j < int(dp[i].size()); ++j)
			for (int k = 0; k < int(dp[i][j].size()); ++k)
				dp[i][j][k] = INF;
	return dp;
}

vector<int> create_pot() {
	vector<int> ans;
	ans.push_back(1);
	for (int i = 1; i < 30; ++i)
		ans.push_back((1LL * ans[i-1] * 10) % MOD);
	return ans;
}

pair<int, int> solve(const auto &i, const auto &less, const auto &mask, const auto &num, const auto &k, auto &dp, const auto &pot) {
	if (dp[i][less][mask] != INF)
		return dp[i][less][mask];
	if (__builtin_popcount(mask) > k)
		return dp[i][less][mask] = {0, 0};
	if (i == int(num.size()))
		return dp[i][less][mask] = {1, 0};
	int fst = 0, snd = 0;
	for (int j = 0; j <= (less ? 9 : num[i]); ++j) {
		int nxt = (j == 0 and mask == 0) ? 0 : (1 << j);
		fst += solve(i + 1, less | (j < num[i]), mask | nxt, num, k, dp, pot).first;
		fst %= MOD;
		int qtd = (1LL * solve(i + 1, less | (j < num[i]), mask | nxt, num, k, dp, pot).first * j) % MOD;
		snd += (1LL * pot[int(num.size()) - i - 1] * qtd) % MOD;
		snd %= MOD;
		snd += solve(i + 1, less | (j < num[i]), mask | nxt, num, k, dp, pot).second;
		snd %= MOD;
	}
	return dp[i][less][mask] = {fst, snd};
}

int magic(const auto &L, const auto &R, const auto &K) {
	int ans = 0;
	auto dp = create_dp();
	ans += solve(0, false, 0, convert(R), K, dp, create_pot()).second;
	dp = create_dp();
	ans -= solve(0, false, 0, convert(L - 1), K, dp, create_pot()).second;
	if (ans < 0)
		ans += MOD;
	return ans;
}

int main () {
	long long L, R; int K; cin >> L >> R >> K;
	return cout << magic(L, R, K) << '\n', 0;
}


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

const int MOD = 998244353;

int build(const auto &i, const auto &less, const auto &mask, const auto &num, const auto &k, auto &dp) {
	if (dp[i][less][mask] != INT_MAX)
		return dp[i][less][mask];
	if (__builtin_popcount(mask) > k)
		return dp[i][less][mask] = 0;
	if (i == int(num.size()))
		return dp[i][less][mask] = 1;
	int ans = 0;
	for (int j = 0; j <= (less ? 9 : num[i]); ++j) {
		int nxt = (j == 0 and mask == 0) ? 0 : (1 << j);
		ans = (ans + build(i + 1, less | (j < num[i]), mask | nxt, num, k, dp)) % MOD;
	}
	return dp[i][less][mask] = ans;
}

int solve(const auto &i, const auto &less, const auto &mask, const auto &num, const auto &dp, const auto &pot) {
	if (i == int(num.size()))
		return 0;
	int ans = 0;
	for (int j = 0; j <= (less ? 9 : num[i]); ++j) {
		int nxt = (j == 0 and mask == 0) ? 0 : (1 << j);
		int qtd = dp[i + 1][less | (j < num[i])][mask | nxt];
		if (qtd == INT_MAX)
			continue;
		qtd = (1LL * j * qtd) % MOD;
		ans = (1LL * pot[int(num.size()) - i - 1] * qtd + ans) % MOD;
		ans = (ans + solve(i + 1, less | (j < num[i]), mask | nxt, num, dp, pot)) % MOD;
	}
	return ans;
}

vector<int> convert(const int &N) {
	vector<int> ans;
	for (int i = N; i > 0; i /= 10)
		ans.push_back(i % 10);
	reverse(ans.begin(), ans.end());
	return ans;
}

vector< vector< vector<int> > > create_dp() {
	vector< vector< vector<int> > > dp;
	dp.resize(21);
	for (int i = 0; i < int(dp.size()); ++i) {
		dp[i].resize(2);
		for (int j = 0; j < int(dp[i].size()); ++j)
			dp[i][j].resize(1 << 11);
	}
	for (int i = 0; i < int(dp.size()); ++i)
		for (int j = 0; j < int(dp[i].size()); ++j)
			for (int k = 0; k < int(dp[i][j].size()); ++k)
				dp[i][j][k] = INT_MAX;
	return dp;
}

vector<int> create_pot() {
	vector<int> ans;
	ans.push_back(1);
	for (int i = 1; i < 30; ++i)
		ans.push_back((1LL * ans[i-1] * 10) % MOD);
	return ans;
}

int magic(const auto &L, const auto &R, const auto &K) {
	int ans = 0;
	auto dp = create_dp();
	auto pot = create_pot();
	build(0, false, 0, convert(R), K, dp);
	ans += solve(0, false, 0, convert(R), dp, pot);
	dp = create_dp();
	build(0, false, 0, convert(L - 1), K, dp);
	ans -= solve(0, false, 0, convert(L - 1), dp, pot);
	if (ans < 0)
		ans += MOD;
	return ans;
}

int main () {
	long long L, R; int K; cin >> L >> R >> K;
	return cout << magic(L, R, K) << '\n', 0;
}


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

const int MOD = 998244353;

int build(const auto &i, const auto &less, const auto &mask, const auto &num, const auto &k, auto &dp) {
	if (dp[i][less][mask] != INT_MAX)
		return dp[i][less][mask];
	if (__builtin_popcount(mask) > k)
		return dp[i][less][mask] = 0;
	if (i == int(num.size()))
		return dp[i][less][mask] = 1;
	int ans = 0;
	for (int j = 0; j <= (less ? 9 : num[i]); ++j) {
		int nxt = (j == 0 and mask == 0) ? 0 : (1 << j);
		ans = (ans + build(i + 1, less | (j < num[i]), mask | nxt, num, k, dp)) % MOD;
	}
	return dp[i][less][mask] = ans;
}

int solve(const auto &i, const auto &less, const auto &mask, const auto &num, const auto &dp, const auto &pot) {
	if (i == int(num.size()))
		return 0;
	int ans = 0;
	for (int j = 0; j <= (less ? 9 : num[i]); ++j) {
		int nxt = (j == 0 and mask == 0) ? 0 : (1 << j);
		int qtd = dp[i + 1][less | (j < num[i])][mask | nxt];
		if (qtd == INT_MAX)
			continue;
		qtd = (1LL * j * qtd) % MOD;
		ans = (1LL * pot[int(num.size()) - i - 1] * qtd + ans) % MOD;
		ans = (ans + solve(i + 1, less | (j < num[i]), mask | nxt, num, dp, pot)) % MOD;
	}
	return ans;
}

vector<int> convert(const auto &N) {
	vector<int> ans;
	for (auto i = N; i > 0; i /= 10)
		ans.push_back(i % 10);
	reverse(ans.begin(), ans.end());
	return ans;
}

vector< vector< vector<int> > > create_dp() {
	vector< vector< vector<int> > > dp;
	dp.resize(21);
	for (int i = 0; i < int(dp.size()); ++i) {
		dp[i].resize(2);
		for (int j = 0; j < int(dp[i].size()); ++j)
			dp[i][j].resize(1 << 11);
	}
	for (int i = 0; i < int(dp.size()); ++i)
		for (int j = 0; j < int(dp[i].size()); ++j)
			for (int k = 0; k < int(dp[i][j].size()); ++k)
				dp[i][j][k] = INT_MAX;
	return dp;
}

vector<int> create_pot() {
	vector<int> ans;
	ans.push_back(1);
	for (int i = 1; i < 30; ++i)
		ans.push_back((1LL * ans[i-1] * 10) % MOD);
	return ans;
}

int magic(const auto &L, const auto &R, const auto &K) {
	int ans = 0;
	auto dp = create_dp();
	auto pot = create_pot();
	build(0, false, 0, convert(R), K, dp);
	ans += solve(0, false, 0, convert(R), dp, pot);
	dp = create_dp();
	build(0, false, 0, convert(L - 1), K, dp);
	ans -= solve(0, false, 0, convert(L - 1), dp, pot);
	if (ans < 0)
		ans += MOD;
	return ans;
}

int main () {
	long long L, R; int K; cin >> L >> R >> K;
	return cout << magic(L, R, K) << '\n', 0;
}


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

const int MOD = 998244353;

int build(const auto &i, const auto &less, const auto &mask, const auto &num, const auto &k, auto &dp) {
	if (dp[i][less][mask] != INT_MAX)
		return dp[i][less][mask];
	if (__builtin_popcount(mask) > k)
		return dp[i][less][mask] = 0;
	if (i == int(num.size()))
		return dp[i][less][mask] = 1;
	int ans = 0;
	for (int j = 0; j <= (less ? 9 : num[i]); ++j) {
		int nxt = (j == 0 and mask == 0) ? 0 : (1 << j);
		ans = (ans + build(i + 1, less | (j < num[i]), mask | nxt, num, k, dp)) % MOD;
	}
	return dp[i][less][mask] = ans;
}

int solve(const auto &i, const auto &less, const auto &mask, const auto &num, const auto &dp, const auto &pot) {
	if (i == int(num.size()))
		return 0;
	int ans = 0;
	for (int j = 0; j <= (less ? 9 : num[i]); ++j) {
		int nxt = (j == 0 and mask == 0) ? 0 : (1 << j);
		int qtd = dp[i + 1][less | (j < num[i])][mask | nxt];
		if (qtd == INT_MAX)
			continue;
		qtd = (1LL * j * qtd) % MOD;
		ans = (1LL * pot[int(num.size()) - i - 1] * qtd + ans) % MOD;
		ans = (ans + solve(i + 1, less | (j < num[i]), mask | nxt, num, dp, pot)) % MOD;
	}
	return ans;
}

vector<int> convert(const auto &N) {
	vector<int> ans;
	for (int i = N; i > 0; i /= 10)
		ans.push_back(i % 10);
	reverse(ans.begin(), ans.end());
	return ans;
}

vector< vector< vector<int> > > create_dp() {
	vector< vector< vector<int> > > dp;
	dp.resize(21);
	for (int i = 0; i < int(dp.size()); ++i) {
		dp[i].resize(2);
		for (int j = 0; j < int(dp[i].size()); ++j)
			dp[i][j].resize(1 << 11);
	}
	for (int i = 0; i < int(dp.size()); ++i)
		for (int j = 0; j < int(dp[i].size()); ++j)
			for (int k = 0; k < int(dp[i][j].size()); ++k)
				dp[i][j][k] = INT_MAX;
	return dp;
}

vector<int> create_pot() {
	vector<int> ans;
	ans.push_back(1);
	for (int i = 1; i < 30; ++i)
		ans.push_back((1LL * ans[i-1] * 10) % MOD);
	return ans;
}

int magic(const auto &L, const auto &R, const auto &K) {
	int ans = 0;
	auto dp = create_dp();
	auto pot = create_pot();
	build(0, false, 0, convert(R), K, dp);
	ans += solve(0, false, 0, convert(R), dp, pot);
	dp = create_dp();
	build(0, false, 0, convert(L - 1), K, dp);
	ans -= solve(0, false, 0, convert(L - 1), dp, pot);
	if (ans < 0)
		ans += MOD;
	return ans;
}

int main () {
	long long L, R; int K; cin >> L >> R >> K;
	return cout << magic(L, R, K) << '\n', 0;
}


#include <iostream>
#include <fstream>
#include <limits.h>
#include <math.h>
#include <vector>

using namespace std;

int main(){
	ios::sync_with_stdio(false);

	int n, i, j;
	cin>>n;
	for(i = 0; i<n; i++){
		for(j=0; j<n; j++){
			if( (abs(n/2+1-i)+abs(n/2+1-j))<=n/2)cout<<"D";
			else cout<<"*";
		}
		cout<<endl;
	}

	//system("pause");
	return 0;
}


#include <iostream>
#include <fstream>
#include <limits.h>
#include <math.h>
#include <vector>

using namespace std;

int main(){
	ios::sync_with_stdio(false);

	int n, i, j;
	cin>>n;
	for(i = 1; i<=n; i++){
		for(j=1; j<=n; j++){
			if( (abs(n/2+1-i)+abs(n/2+1-j))<=n/2)cout<<"D";
			else cout<<"*";
		}
		cout<<endl;
	}

	//system("pause");
	return 0;
}


#include <iostream>
#include <fstream>
#include <limits.h>
#include <math.h>
#include <vector>

using namespace std;

int main(){
	ios::sync_with_stdio(false);

	int n, i, j;
	for(i = 0; i<n; i++){
		for(j=0; j<n; j++){
			if( (abs(n/2+1-i)+abs(n/2+1-j))<=n/2)cout<<"D";
			else cout<<"*";
		}
		cout<<endl;
	}

	//system("pause");
	return 0;
}


#include<iostream>
using namespace std;

int main(){
    int n;cin>>n;
    int p=1,lines=0;
    while(lines != n){
        for(int i=0;i<n/2;i++){
        cout<<"*";
        }
        for(int j=0;j<p;j++){
            cout<<"D";
        }
        for(int i=0;i<n/2;i++){
            cout<<"*";
        }
        lines++;
        if(lines <= n / 2) p += 2;
        else p -= 2;
        cout<<'\n';
    }
    return 0;
}


#include<iostream>
using namespace std;

int main(){
    int n;cin>>n;
    int p=1,lines=0;
    while(lines != n){
        for(int i=0;i<(n - p)/2;i++){
        cout<<"*";
        }
        for(int j=0;j<p;j++){
            cout<<"D";
        }
        for(int i=0;i<(n - p)/2;i++){
            cout<<"*";
        }
        lines++;
        if(lines <= n / 2) p += 2;
        else p -= 2;
        cout<<'\n';
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <memory.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <string>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <valarray>
#include <sstream>
#include <fstream>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi ;
typedef vector<double> vd;
typedef pair<int, int> ii;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef map<int,int> mii;
typedef map<string,int> msi;
typedef map<int,string> mis;

#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,n) for(int i=0; i<n; i++)
#define rlop(i,n) for(int i=n-1; i>=0; i--)
#define loop(i,start,n) for(int i=start; i<n; i++)
#define rloop(i,end,n) for(int i=n-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define f first
#define s second
#define ord0(s) (s-'0')
#define orda(s) (s-'a')
#define ordA(s) (s-'A')

const ll OO = 1e8;
const double EPS = 1e-5;
const double PI=acos(-1.0);

int gcd (int x, int y)
{
	return !y ? x : gcd(y, x%y);
}

int main()
{
//freopen ("divisors.in", "r", stdin);
//freopen("","w",stdout);

int n,c;
cin>>n;
c=n/2;
lop(i,n){
lop(j,n){
if(i==c||j==c||(j<c&&j>=c-(i%c))||(j>c&&j<=c+(i%c))) cout<<'D';
else cout<<'*';
}
cout<<endl;
}

return 0;
}


#include <iostream>
#include <stdio.h>
#include <memory.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <string>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <valarray>
#include <sstream>
#include <fstream>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi ;
typedef vector<double> vd;
typedef pair<int, int> ii;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef map<int,int> mii;
typedef map<string,int> msi;
typedef map<int,string> mis;

#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,n) for(int i=0; i<n; i++)
#define rlop(i,n) for(int i=n-1; i>=0; i--)
#define loop(i,start,n) for(int i=start; i<n; i++)
#define rloop(i,end,n) for(int i=n-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define f first
#define s second
#define ord0(s) (s-'0')
#define orda(s) (s-'a')
#define ordA(s) (s-'A')

const ll OO = 1e8;
const double EPS = 1e-5;
const double PI=acos(-1.0);

int gcd (int x, int y)
{
	return !y ? x : gcd(y, x%y);
}

int main()
{
//freopen ("divisors.in", "r", stdin);
//freopen("","w",stdout);

int n,c,col;
cin>>n;
c=n/2;
lop(i,n){
lop(j,n){
col=(i==c)?1:(i<c&&((j<c&&j>=c-i)||(j>c&&j<=c+i)))?1:(i>c&&((j<c&&j>=c-(n-1-i))||(j>c&&j<=c+n-1-i)))?1:0;
if(col) cout<<'D';
else cout<<'*';
}
cout<<endl;
}

return 0;
}


#include <iostream>
#include <stdio.h>
#include <memory.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <string>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <valarray>
#include <sstream>
#include <fstream>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi ;
typedef vector<double> vd;
typedef pair<int, int> ii;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef map<int,int> mii;
typedef map<string,int> msi;
typedef map<int,string> mis;

#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,n) for(int i=0; i<n; i++)
#define rlop(i,n) for(int i=n-1; i>=0; i--)
#define loop(i,start,n) for(int i=start; i<n; i++)
#define rloop(i,end,n) for(int i=n-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define f first
#define s second
#define ord0(s) (s-'0')
#define orda(s) (s-'a')
#define ordA(s) (s-'A')

const ll OO = 1e8;
const double EPS = 1e-5;
const double PI=acos(-1.0);

int gcd (int x, int y)
{
	return !y ? x : gcd(y, x%y);
}

int main()
{
//freopen ("divisors.in", "r", stdin);
//freopen("","w",stdout);

int n,c;
cin>>n;
c=n/2;
lop(i,n){
lop(j,n){
if(j==c||(j<c&&j>=c-i)||(j>c&&j<=c+i)) cout<<'D';
else cout<<'*';
}
cout<<endl;
}

return 0;
}


#include <iostream>
#include <stdio.h>
#include <memory.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <string>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <valarray>
#include <sstream>
#include <fstream>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi ;
typedef vector<double> vd;
typedef pair<int, int> ii;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef map<int,int> mii;
typedef map<string,int> msi;
typedef map<int,string> mis;

#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,n) for(int i=0; i<n; i++)
#define rlop(i,n) for(int i=n-1; i>=0; i--)
#define loop(i,start,n) for(int i=start; i<n; i++)
#define rloop(i,end,n) for(int i=n-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define f first
#define s second
#define ord0(s) (s-'0')
#define orda(s) (s-'a')
#define ordA(s) (s-'A')

const ll OO = 1e8;
const double EPS = 1e-5;
const double PI=acos(-1.0);

int gcd (int x, int y)
{
	return !y ? x : gcd(y, x%y);
}

int main()
{
//freopen ("divisors.in", "r", stdin);
//freopen("","w",stdout);

int n,c;
cin>>n;
c=n/2;
lop(i,n){
lop(j,n){
if(j==c || j==c-i || j==c+i) cout<<'D';
else cout<<'*';
}
cout<<endl;
}

return 0;
}


#include <iostream>
#include <stdio.h>
#include <memory.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <string>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <valarray>
#include <sstream>
#include <fstream>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi ;
typedef pair<int, int> ii;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef map<int,int> mii;
typedef map<string,int> msi;
typedef map<int,string> mis;

#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,n) for(int i=0; i<n; i++)
#define rlop(i,n) for(int i=n-1; i>=0; i--)
#define loop(i,start,n) for(int i=start; i<n; i++)
#define rloop(i,end,n) for(int i=n-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define f first
#define s second
#define ord0(s) (s-'0')
#define orda(s) (s-'a')
#define ordA(s) (s-'A')

const ll OO = 1e8;
const double EPS = 1e-5;
const double PI=acos(-1.0);

void main(){
int n,c; cin>>n;
	c=n/2;
	lop(i,n){
		lop(j,n){
			if(i==c) cout<<'D';
			else if(i<c && j>=c-i && j<=c+i) cout<<'D';
			else if(i>c && j>=i-c && j<=3*c-i) cout<<'D';
			else cout<<'*';
		}
		cout<<endl;
	}
}


#include <iostream>
#include <stdio.h>
#include <memory.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <string>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <valarray>
#include <sstream>
#include <fstream>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi ;
typedef vector<double> vd;
typedef pair<int, int> ii;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef map<int,int> mii;
typedef map<string,int> msi;
typedef map<int,string> mis;

#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,n) for(int i=0; i<n; i++)
#define rlop(i,n) for(int i=n-1; i>=0; i--)
#define loop(i,start,n) for(int i=start; i<n; i++)
#define rloop(i,end,n) for(int i=n-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define f first
#define s second
#define ord0(s) (s-'0')
#define orda(s) (s-'a')
#define ordA(s) (s-'A')

const ll OO = 1e8;
const double EPS = 1e-5;
const double PI=acos(-1.0);

int gcd (int x, int y)
{
	return !y ? x : gcd(y, x%y);
}

int main()
{
//freopen ("divisors.in", "r", stdin);
//freopen("","w",stdout);

int n,c,col;
cin>>n;
c=n/2;
lop(i,n){
lop(j,n){
col=(i==c)?1:(i<c&&((j<c&&j>=c-i)||(j>c&&j<=c+i))?1:(i>c&&((j<c&&j>=c-(n-1-i))||(j>c&&j<=c+n-1-i))?1:0;
if(col) cout<<'D';
else cout<<'*';
}
cout<<endl;
}

return 0;
}


#include <iostream>
#include <algorithm>
#include<math.h>

using namespace std;
int main()
{
    int a,c;
    cin>>a;
    for(int i=1;i<a+1;i++)
    {
        c=abs(a/2-i+1);
        for(int j=0;j<c;j++)
        cout<<'*';
        for(int j=0;j<a-c*2;j++)
    cout<<'D';
        for(int j=0;j<c;j++)
    cout<<'*';
    cout<<endl;

    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include<math.h>

using namespace std;
int main()
{
    int a,c;
    cin>>a;
    for(int i=1;i<a+1;i++)
    {
        c=abs(a/2-i+1);
        for(int j=0;j<c;j++)
        cout<<'*';
        for(int j=0;j<a-c*2;j++)
    cout<<'D';
        for(int j=0;j<c;j++)
    cout<<'*'<<endl;

    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include<math.h>

using namespace std;
int main()
{
    int a,b;
    cin>>a;
    for(int i=1;i<a+1;i++)
    {
        c=abs(a/2-i+1);
        for(int j=0;j<c;j++)
        cout<<'*';
        for(int j=0;j<a-c*2;j++)
    cout<<'D';
        for(int j=0;j<c;j++)
    cout<<'*'<<endl;

    }
    return 0;
}


#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
	printf("input n: ");
	int n;
	scanf_s("%d",&n);
	int m = 0;
	for (int i = 1; i <= ((n-1)/2)+1; i++)
	{
		m = ((n - 1) / 2)-i+1;
		for (int j = 1; j <= m; j++) printf("*");
		for (int k = 1; k <= -1 + (2 * i); k++) printf("D");
		for (int l = 1; l <= m; l++) printf("*");
		printf("\n");
	}
	for (int i = ((n - 1) / 2); i >=1 ; i--)
	{
		m = ((n - 1) / 2) - i + 1;
		for (int j = 1; j <= m; j++) printf("*");
		for (int k = 1; k <= -1 + (2 * i); k++) printf("D");
		for (int l = 1; l <= m; l++) printf("*");
		printf("\n");
	}
	return 0;
}


#pragma comment(linker, "/STACK:250000000")
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <string>

using namespace std;

#define _USE_MATH_DEFINES
#define ll long long
#define Inf 2147483000
#define For(i, n) for(int i = 0; i < n; ++i)

class leg {
public:
  int length, energy;
  bool operator < (leg another) {
    return length < another.length;
  }
};

long long gcd( long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}

int main() {
  ios_base::sync_with_stdio(false);

  int n;
  cin >> n;
  int k = n / 2 + 1;
  For(i, n) {
    For(j, n) {
      if (abs(i+1-k) + abs(j+1-k) >= k)
        cout << '.';
      else
        cout << 'D';
    }
    cout << '\n';
  }
  return 0;
}


#pragma comment(linker, "/STACK:250000000")
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <string>

using namespace std;

#define _USE_MATH_DEFINES
#define ll long long
#define Inf 2147483000
#define For(i, n) for(int i = 0; i < n; ++i)

class leg {
public:
  int length, energy;
  bool operator < (leg another) {
    return length < another.length;
  }
};

long long gcd( long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}

int main() {
  ios_base::sync_with_stdio(false);

  int n;
  cin >> n;
  int k = n / 2 + 1;
  For(i, n) {
    For(j, n) {
      if (abs(i+1-k) + abs(j+1-k) >= k)
        cout << '*';
      else
        cout << 'D';
    }
    cout << '\n';
  }
  return 0;
}


#include <iostream>
using namespace std;

void main(){
    int n,i,j,k;
    cin >> n;
    k = (n + 1) / 2;
    for (i = 1; i <= n; i++){
        for (j = 1; j <= n; j++){
            if (abs(i - k) + abs(j - k) <= n / 2) cout << "D";
            else cout << "*";
        }
        cout << endl;
    }
    system("pause");

}


#include <iostream>
using namespace std;

void main(){
    int n,i,j,k;
    cin >> n;
    k = (n + 1) / 2;
    for (i = 1; i <= n; i++){
        for (j = 1; j <= n; j++){
            if (abs(i - k) + abs(j - k) <= n / 2) cout << "D";
            else cout << "*";
        }
        cout << endl;
    }
}


#pragma comment(linker, "/STACK:512000000")

#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<stdio.h>
#include<cassert>
#include<cstdio>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<climits>
#include<list>
#include<iterator>

using namespace std;

#define MP make_pair
#define PB push_back
#define ll long long
#define ull unsigned long long
#define dbl double
#define ALL(X) (X).begin(), (X).end()
#define RALL(X) (X).rbegin(), (X).rend()
#define CLR(a, x) memset(a, x, sizeof(a))
#define sqr(a) ((a) * (a))
#define two(a) (1LL << (a))
#define has(mask, a) ((mask) & two(a) ? 1 : 0)

const int N = 105;
const int MOD = 1e9 + 7;
const long long INF = two(30);

void atob(int &a, int &b) {
    a ^= b;
    b ^= a;
    a ^= b;
}

int n;
char ans[N][N];

void init() {
    for(int i = 0; i < N; i++)
           for(int j = 0; j < N; j++)
                  ans[i][j] = '*';
}

int Solve()
{
	init();
	cin >> n;
	int centre = (n >> 1);
	for (int i = 0; i < n; i++) {
	      ans[i][centre] = 'D';
	      ans[centre][i] = 'D';

	}
	int cur = 1;
	for (int i = 1; i < centre; i++) {
	        for (int j = centre - cur; j <= centre + cur; j++) {
	             ans[i][j] = ans[n - i - 1][j] = 'D';
	        }
	        cur++;
	}
	for (int i = 0; i < n; i++) {
	     for (int j = 0; j < n; j++) {
	           cout << ans[i][j] << ' ';
	     }
	     cout << endl;
	}
	return 0;
}

int main()
{
	ios::sync_with_stdio(false);
	return Solve();
}


#pragma comment(linker, "/STACK:512000000")

#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<stdio.h>
#include<cassert>
#include<cstdio>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<climits>
#include<list>
#include<iterator>

using namespace std;

#define MP make_pair
#define PB push_back
#define ll long long
#define ull unsigned long long
#define dbl double
#define ALL(X) (X).begin(), (X).end()
#define RALL(X) (X).rbegin(), (X).rend()
#define CLR(a, x) memset(a, x, sizeof(a))
#define sqr(a) ((a) * (a))
#define two(a) (1LL << (a))
#define has(mask, a) ((mask) & two(a) ? 1 : 0)

const int N = 105;
const int MOD = 1e9 + 7;
const long long INF = two(30);

void atob(int &a, int &b) {
    a ^= b;
    b ^= a;
    a ^= b;
}

int n;
char ans[N][N];

void init() {
    for(int i = 0; i < N; i++)
           for(int j = 0; j < N; j++)
                  ans[i][j] = '*';
}

int Solve()
{
	init();
	cin >> n;
	int centre = (n >> 1);
	for (int i = 0; i < n; i++) {
	      ans[i][centre] = 'D';
	      ans[centre][i] = 'D';

	}
	int cur = 1;
	for (int i = 1; i < centre; i++) {
	        for (int j = centre - cur; j <= centre + cur; j++) {
	             ans[i][j] = ans[n - i - 1][j] = 'D';
	        }
	        cur++;
	}
	for (int i = 0; i < n; i++) {
	     for (int j = 0; j < n; j++) {
	           cout << ans[i][j];
	     }
	     cout << endl;
	}
	return 0;
}

int main()
{
	ios::sync_with_stdio(false);
	return Solve();
}


#include <iostream>
#include <string>
using namespace std;

int main()
{
	int Size;
	cin >> Size;
	for (int i = 0; i <= (Size / 2); i++)
	{
		for (int j = 0; j < (Size/2)-i; j++)
		{
			cout << "*";
		}
		for (int k = 0; k <(i*2)+1; k++)
			cout << "D";
		for (int j = 0; j < (Size / 2) -i; j++)
		{
			cout << "*";
		}
		cout << endl;
	}
	for (int i = Size/2-1; i>=0; i--)
	{
		for (int j = 0; j < (Size / 2) - i; j++)
		{
			cout << "*";
		}
		for (int k = 0; k <(i * 2) + 1; k++)
			cout << "D";
		for (int j = 0; j < (Size / 2) - i; j++)
		{
			cout << "*";
		}
		cout << endl;
	}
	//system("pause");
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <ctime>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstring>
using namespace std;

#define pb push_back
#define rs resize
#define mp make_pair
#define inf 1e9
#define pi 3.1415926535897932384626433832795
#define sz(a) (a).size()
#define Sort(a) sort((a).begin(), (a).end())
#define Reverse(a) reverse((a).begin(), (a).end())
#define sf scanf
#define pf printf
#define ms(a, x) memset((a), (x), sizeof(a))

typedef vector <int> vi;
typedef vector <vi> vvi;
typedef vector <vvi> vvvi;
typedef vector <vvvi> vvvvi;
typedef vector <bool> vb;
typedef vector <vb> vvb;
typedef vector <vvb> vvvb;
typedef vector <vvvb> vvvvb;
typedef long long ll;
typedef vector <ll> vl;
typedef vector <vl> vvl;
typedef vector <vvl> vvvl;
typedef vector <vvvl> vvvvl;
typedef pair <int, int> ii;
typedef vector <ii> vii;
typedef vector <vii> vvii;
typedef pair <int, ll> il;
typedef vector <il> vil;
typedef vector <vil> vvil;
typedef pair <ll, int> li;
typedef vector <li> vli;
typedef vector <vli> vvli;
typedef set <int> si;
typedef set <li> sli;
typedef set <il> sil;
typedef vector <string> vs;
typedef vector <vs> vvs;
typedef vector <vvs> vvvs;
typedef map <string, int> msi;
typedef map <char, int> mci;
typedef pair <ll, ll> pll;

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    for (int i = 0; i < n / 2; ++i)
    {
        int x = 1 + i * 2;
        for (int j = 0; j < (n - x) / 2; ++j)
        {
            cout << '.';
        }
        for (int j = 0; j < x; ++j)
        {
            cout << 'D';
        }
        for (int j = 0; j < (n - x) / 2; ++j)
        {
            cout << '.';
        }
        cout << endl;
    }
    for (int i = n / 2; i >= 0; --i)
    {
        int x = 1 + i * 2;
        for (int j = 0; j < (n - x) / 2; ++j)
        {
            cout << '.';
        }
        for (int j = 0; j < x; ++j)
        {
            cout << 'D';
        }
        for (int j = 0; j < (n - x) / 2; ++j)
        {
            cout << '.';
        }
        cout << endl;
    }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <ctime>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstring>
using namespace std;

#define pb push_back
#define rs resize
#define mp make_pair
#define inf 1e9
#define pi 3.1415926535897932384626433832795
#define sz(a) (a).size()
#define Sort(a) sort((a).begin(), (a).end())
#define Reverse(a) reverse((a).begin(), (a).end())
#define sf scanf
#define pf printf
#define ms(a, x) memset((a), (x), sizeof(a))

typedef vector <int> vi;
typedef vector <vi> vvi;
typedef vector <vvi> vvvi;
typedef vector <vvvi> vvvvi;
typedef vector <bool> vb;
typedef vector <vb> vvb;
typedef vector <vvb> vvvb;
typedef vector <vvvb> vvvvb;
typedef long long ll;
typedef vector <ll> vl;
typedef vector <vl> vvl;
typedef vector <vvl> vvvl;
typedef vector <vvvl> vvvvl;
typedef pair <int, int> ii;
typedef vector <ii> vii;
typedef vector <vii> vvii;
typedef pair <int, ll> il;
typedef vector <il> vil;
typedef vector <vil> vvil;
typedef pair <ll, int> li;
typedef vector <li> vli;
typedef vector <vli> vvli;
typedef set <int> si;
typedef set <li> sli;
typedef set <il> sil;
typedef vector <string> vs;
typedef vector <vs> vvs;
typedef vector <vvs> vvvs;
typedef map <string, int> msi;
typedef map <char, int> mci;
typedef pair <ll, ll> pll;

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    for (int i = 0; i < n / 2; ++i)
    {
        int x = 1 + i * 2;
        for (int j = 0; j < (n - x) / 2; ++j)
        {
            cout << '*';
        }
        for (int j = 0; j < x; ++j)
        {
            cout << 'D';
        }
        for (int j = 0; j < (n - x) / 2; ++j)
        {
            cout << '*';
        }
        cout << endl;
    }
    for (int i = n / 2; i >= 0; --i)
    {
        int x = 1 + i * 2;
        for (int j = 0; j < (n - x) / 2; ++j)
        {
            cout << '*';
        }
        for (int j = 0; j < x; ++j)
        {
            cout << 'D';
        }
        for (int j = 0; j < (n - x) / 2; ++j)
        {
            cout << '*';
        }
        cout << endl;
    }
}


#include <iostream>
using namespace std;
int main()
{
int d;
cin>>d;
int t=d/2;
for(int i=1;i<=d;i++)
{
if(i%2==0)continue;
for(int y=1;y<=t;y++){cout<<"*";}
for(int j=1;j<=i;j++)
{cout<<"D";}
for(int y=1;y<=t;y++){cout<<"*";}
cout<<endl;t--;}
t=1;
for(int i=d-1;i>=1;i--)
{
if(i%2==0){continue;}
for(int y=1;y<=t;y++){cout<<"*";}
for(int j=i;j>=1;j--)
{ cout<<"D";}
for(int y=1;y<=t;y++){cout<<"*";}
cout<<endl;t++;}
}


#include <iostream>
using namespace std;
int main()
{
  int d;
  cin>>d;
  int t=d/2;
  for(int i=1;i<=d;i++)
  {
      if(i%2==0)continue;
      for(int y=1;y<=t;y++){cout<<"*";}
   for(int j=1;j<=i;j++)
  {cout<<"D";}
  /**/
 for(int y=1;y<=t;y++){cout<<"*";}
 cout<<endl;t--;}
 t=1;
   for(int i=d-1;i>=1;i--)
  {
      if(i%2==0){continue;}
      for(int y=1;y<=t;y++){cout<<"*";}

   for(int j=i;j>=1;j--)
  { cout<<"D";}

 for(int y=1;y<=t;y++){cout<<"*";}
 cout<<endl;t++;}
}


#include <iostream>

int main()
{
  using std::cout;
  using std::endl;
  using std::cin;
  int n;
  //cout<< "Iveskite n: "<<endl;
  cin>>n;
  char mas[100][100];
  int pradzia = 0;
  int pabaiga = n-1;
  int ateminys=1;

//U�pildome matric� "*"
 for (int i=0; i<n; i++){
		for (int j=0; j<n; j++){
			mas[i][j]='*';
		}
		cout<<endl;
 }

 //Vir��n�, apa�ia ir vidurys u�pildomi "D"
 for (int i=0; i<n; i++){
		for (int j=0; j<n; j++ ){
			if (i==(n/2))
			{
				mas[i][j]='D';
			}
			else if ( i==0 || i==n-1 )
			{
				mas[i][n/2]='D';
			}
		}
 }

//Nuo vir��n�s iki vidurio
   for (int i=0; i<n; i++){
		for (int j=0; j<n; j++ ){
			if(i<(n/2) && i != 0 && j<pabaiga && j>pradzia)
			{
				mas[i][j]='D';
			}
		}
		pradzia=(n/2)-i-2;	//GERAI
		pabaiga=(n/2)+i+2;	//GERAI
 }

 //Nuo vidurio �em�jant iki apa�ios
  for (int i=0; i<n; i++){
		for (int j=0; j<n; j++ ){

			if(i>(n/2) && i != n-1 && j<pabaiga && j>pradzia)
			{
				mas[i][j]='D';
			}
			cout<<mas[i][j];
		}
		pradzia=i-(n/2);	//GERAI
		pabaiga=(n/2)+n-i-1;//GERAI

		cout<<endl;
 }
/*
 cout<<"numeriai"<<endl;
  for (int i=0; i<n; i++){
		for (int j=0; j<n; j++){
		cout<<i<<j<<" ";
		}
		cout<<endl;
 }
  */
	 return 0;
}


#include <iostream>

int main()
{
  using std::cout;
  using std::endl;
  using std::cin;
  int n;
  //cout<< "Iveskite n: "<<endl;
  cin>>n;
  char mas[101][101];
  int pradzia = 0;
  int pabaiga = n-1;
  int ateminys=1;

//U�pildome matric� "*"
 for (int i=0; i<n; i++){
		for (int j=0; j<n; j++){
			mas[i][j]='*';
		}
		//cout<<endl;
 }

 //Vir��n�, apa�ia ir vidurys u�pildomi "D"
 for (int i=0; i<n; i++){
		for (int j=0; j<n; j++ ){
			if (i==(n/2))
			{
				mas[i][j]='D';
			}
			else if ( i==0 || i==n-1 )
			{
				mas[i][n/2]='D';
			}
		}
 }

//Nuo vir��n�s iki vidurio
   for (int i=0; i<n; i++){
		for (int j=0; j<n; j++ ){
			if(i<(n/2) && i != 0 && j<pabaiga && j>pradzia)
			{
				mas[i][j]='D';
			}
		}
		pradzia=(n/2)-i-2;	//GERAI
		pabaiga=(n/2)+i+2;	//GERAI
 }

 //Nuo vidurio �em�jant iki apa�ios
  for (int i=0; i<n; i++){
		for (int j=0; j<n; j++ ){

			if(i>(n/2) && i != n-1 && j<pabaiga && j>pradzia)
			{
				mas[i][j]='D';
			}
			cout<<mas[i][j];
		}
		pradzia=i-(n/2);	//GERAI
		pabaiga=(n/2)+n-i-1;//GERAI

		cout<<endl;
 }
/*
 cout<<"numeriai"<<endl;
  for (int i=0; i<n; i++){
		for (int j=0; j<n; j++){
		cout<<i<<j<<" ";
		}
		cout<<endl;
 }
  */
	 return 0;
}


Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Liitle_Pony", "Liitle_Pony\Liitle_Pony.vcxproj", "{D6A14C8C-835A-4286-98B7-3431F7389783}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Win32 = Debug|Win32
		Release|Win32 = Release|Win32
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{D6A14C8C-835A-4286-98B7-3431F7389783}.Debug|Win32.ActiveCfg = Debug|Win32
		{D6A14C8C-835A-4286-98B7-3431F7389783}.Debug|Win32.Build.0 = Debug|Win32
		{D6A14C8C-835A-4286-98B7-3431F7389783}.Release|Win32.ActiveCfg = Release|Win32
		{D6A14C8C-835A-4286-98B7-3431F7389783}.Release|Win32.Build.0 = Release|Win32
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


#include <iostream>

int main()
{
  using std::cout;
  using std::endl;
  using std::cin;
  int n;
  //cout<< "Iveskite n: "<<endl;
  cin>>n;
  char mas[100][100];
  int pradzia = 0;
  int pabaiga = n-1;
  int ateminys=1;

//U�pildome matric� "*"
 for (int i=0; i<n; i++){
		for (int j=0; j<n; j++){
			mas[i][j]='*';
		}
		//cout<<endl;
 }

 //Vir��n�, apa�ia ir vidurys u�pildomi "D"
 for (int i=0; i<n; i++){
		for (int j=0; j<n; j++ ){
			if (i==(n/2))
			{
				mas[i][j]='D';
			}
			else if ( i==0 || i==n-1 )
			{
				mas[i][n/2]='D';
			}
		}
 }

//Nuo vir��n�s iki vidurio
   for (int i=0; i<n; i++){
		for (int j=0; j<n; j++ ){
			if(i<(n/2) && i != 0 && j<pabaiga && j>pradzia)
			{
				mas[i][j]='D';
			}
		}
		pradzia=(n/2)-i-2;	//GERAI
		pabaiga=(n/2)+i+2;	//GERAI
 }

 //Nuo vidurio �em�jant iki apa�ios
  for (int i=0; i<n; i++){
		for (int j=0; j<n; j++ ){

			if(i>(n/2) && i != n-1 && j<pabaiga && j>pradzia)
			{
				mas[i][j]='D';
			}
			cout<<mas[i][j];
		}
		pradzia=i-(n/2);	//GERAI
		pabaiga=(n/2)+n-i-1;//GERAI

		cout<<endl;
 }
/*
 cout<<"numeriai"<<endl;
  for (int i=0; i<n; i++){
		for (int j=0; j<n; j++){
		cout<<i<<j<<" ";
		}
		cout<<endl;
 }
  */
	 return 0;
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleApplication1", "ConsoleApplication1\ConsoleApplication1.vcxproj", "{911CC1AE-50BE-4439-A392-A4DA6DB70578}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Win32 = Debug|Win32
		Release|Win32 = Release|Win32
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{911CC1AE-50BE-4439-A392-A4DA6DB70578}.Debug|Win32.ActiveCfg = Debug|Win32
		{911CC1AE-50BE-4439-A392-A4DA6DB70578}.Debug|Win32.Build.0 = Debug|Win32
		{911CC1AE-50BE-4439-A392-A4DA6DB70578}.Release|Win32.ActiveCfg = Release|Win32
		{911CC1AE-50BE-4439-A392-A4DA6DB70578}.Release|Win32.Build.0 = Release|Win32
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


#include <iostream>

int main()
{
  using std::cout;
  using std::endl;
  using std::cin;
  int n;
  cout<< "Iveskite n: "<<endl;
  cin>>n;
  char mas[100][100];
  int pradzia = 0;
  int pabaiga = n-1;
  int ateminys=1;

//U�pildome matric� "*"
 for (int i=0; i<n; i++){
		for (int j=0; j<n; j++){
			mas[i][j]='*';
		}
		cout<<endl;
 }

 //Vir��n�, apa�ia ir vidurys u�pildomi "D"
 for (int i=0; i<n; i++){
		for (int j=0; j<n; j++ ){
			if (i==(n/2))
			{
				mas[i][j]='D';
			}
			else if ( i==0 || i==n-1 )
			{
				mas[i][n/2]='D';
			}
		}
 }

//Nuo vir��n�s iki vidurio
   for (int i=0; i<n; i++){
		for (int j=0; j<n; j++ ){
			if(i<(n/2) && i != 0 && j<pabaiga && j>pradzia)
			{
				mas[i][j]='D';
			}
		}
		pradzia=(n/2)-i-2;	//GERAI
		pabaiga=(n/2)+i+2;	//GERAI
 }

 //Nuo vidurio �em�jant iki apa�ios
  for (int i=0; i<n; i++){
		for (int j=0; j<n; j++ ){

			if(i>(n/2) && i != n-1 && j<pabaiga && j>pradzia)
			{
				mas[i][j]='D';
			}
			cout<<mas[i][j];
		}
		pradzia=i-(n/2);	//GERAI
		pabaiga=(n/2)+n-i-1;//GERAI

		cout<<endl;
 }
/*
 cout<<"numeriai"<<endl;
  for (int i=0; i<n; i++){
		for (int j=0; j<n; j++){
		cout<<i<<j<<" ";
		}
		cout<<endl;
 }
  */
	 return 0;
}


#include <iostream>
 using namespace std;
int main()
  {
	  int n, vid, k, a;
	  cout << "Input a: ";
	  cin >> a;
	  cout << endl;
	  k = 1;
	  n = a / 2;
	  vid = n + 1;
	  for(int i = 1; i <= a; i++)
	     {
			 for(int j = 1; j <= n; j++)
				 cout << "*";
			 for (int j = 1; j <= k; j++)
				 cout << "D";
			 for(int j = 1; j <= n; j++)
				 cout << "*";
			        if (i >= vid)
			            {
			        		n += 1;
				        	k -= 2;
			            }
			        else
			            {
				        	n -= 1;
				        	k += 2;
			            }
			 cout << endl;
	     }
	  system("pause");
	  return 0;
  }


#include <iostream>
 using namespace std;
int main()
  {
	  int n, vid, k, a;
	  cin >> a;
	  cout << endl;
	  k = 1;
	  n = a / 2;
	  vid = n + 1;
	  for(int i = 1; i <= a; i++)
	     {
			 for(int j = 1; j <= n; j++)
				 cout << "*";
			 for (int j = 1; j <= k; j++)
				 cout << "D";
			 for(int j = 1; j <= n; j++)
				 cout << "*";
			        if (i >= vid)
			            {
			        		n += 1;
				        	k -= 2;
			            }
			        else
			            {
				        	n -= 1;
				        	k += 2;
			            }
			 cout << endl;
	     }
	  return 0;
  }


#include <iostream>
 using namespace std;
int main()
  {
	  int n, vid, k, a;
	  cin >> a;
	  k = 1;
	  n = a / 2;
	  vid = n + 1;
	  for(int i = 1; i <= a; i++)
	     {
			 for(int j = 1; j <= n; j++)
				 cout << "*";
			 for (int j = 1; j <= k; j++)
				 cout << "D";
			 for(int j = 1; j <= n; j++)
				 cout << "*";
			        if (i >= vid)
			            {
			        		n += 1;
				        	k -= 2;
			            }
			        else
			            {
				        	n -= 1;
				        	k += 2;
			            }
			 cout << endl;
	     }
	  return 0;
  }


#include<stdio.h>

int main()
{
	int n,mid1,mid2,flag=0;
	scanf("%d",&n);
	mid1=mid2=(n/2)+1;
	for(int q=1;q<=n;q++)
	{
		for(int w=1;w<=n;w++)
		{
			if(w<mid1||w>mid2)
			{
				printf("*");
			}
			else
			{
				printf("D");
			}
		}
		if(mid1==1&&mid2==n)
		{
			flag=1;
		}
		if(flag==0)
		{
			mid1--;mid2++;
		}
		else
		{
			mid1++;mid2--;
		}

		printf("\n");
	}
}


#include <iostream>
#include <set>
using namespace std;

int main()
{
    int n;
    cin >> n;

    char *p = new char[n];
    int ind = n / 2;
    int tn = n;
    while(tn--)
    {
        memset(p, 'D', n);
        int t = abs(ind);
        memset(p, '*', t);
        memset(p+(n-t), '*', t);
        --ind;
        cout << p << endl;
    }

    return 0;
}


#include <iostream>
using namespace std;

int main()
{
    int n;
    cin >> n;

    char *p = new char[n];
    int ind = n / 2;
    int tn = n;
    while(tn--)
    {
        memset(p, 'D', n);
        int t = abs(ind);
        memset(p, '*', t);
        memset(p+(n-t), '*', t);
        --ind;
        p[n] = 0;
        cout << p << endl;
    }

    return 0;
}


#include <iostream>
#include <set>
using namespace std;

int main()
{
    int n;
    cin >> n;

    char *p = new char[n+1];
    int ind = n / 2;
    int tn = n;
    while(tn--)
    {
        memset(p, 'D', n);
        int t = abs(ind);
        memset(p, '*', t);
        memset(p+(n-t), '*', t);
        --ind;
        cout << p << endl;
    }

    return 0;
}


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

using namespace std;

const int DIV = 1000000007;

#define MAX(a, b) (a < b ? b : a)
#define MIN(a, b) (b < a ? b : a)

int main(int argc, char* argv[])
{
	FILE *f = fopen("in.txt", "r");
	//FILE *f = stdin;
	int n, m, k;
	fscanf(f, "%d %d %d\n", &n, &m, &k);
	/*if (n < m) {
		int tmp = n;
		n = m;
		m = tmp;
	}*/
	if (k > n + m - 2) {
		printf("-1\n");
		return 0;
	}
	int kn = k % (n - 1);
	int km = k - kn;
	int n_min = n / (kn + 1);
	int m_min = m / (km + 1);
	long long res = n_min * m_min;
	int d, kv;
	d = 1; kv = sqrt(double(n)) + 1;
	while (d <= kv) {
		if (true) {
			kn = d - 1;
			km = k - kn;
			if (kn <= k && kn <= (n - 1) && km <= (m - 1)) {
				n_min = n / (kn + 1);
				m_min = m / (km + 1);
				long long res2 = n_min * m_min;
				if (res2 > res)
					res = res2;
			}
			kn = (n / d) - 1;
			km = k - kn;
			if (kn <= k && kn <= (n - 1) && km <= (m - 1)) {
				n_min = n / (kn + 1);
				m_min = m / (km + 1);
				long long res2 = n_min * m_min;
				if (res2 > res)
					res = res2;
			}
		}
		d++;
	}
	d = 1; kv = sqrt(double(m)) + 1;
	while (d <= kv) {
		if (true) {
			km = d - 1;
			kn = k - km;
			if (km <= k && kn <= (n - 1) && km <= (m - 1)) {
				n_min = n / (kn + 1);
				m_min = m / (km + 1);
				long long res2 = n_min * m_min;
				if (res2 > res)
					res = res2;
			}
			km = (m / d) - 1;
			kn = k - km;
			if (km <= k && kn <= (n - 1) && km <= (m - 1)) {
				n_min = n / (kn + 1);
				m_min = m / (km + 1);
				long long res2 = n_min * m_min;
				if (res2 > res)
					res = res2;
			}
		}
		d++;
	}
	printf("%I64d\n", res);
	return 0;
}


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

using namespace std;

const int DIV = 1000000007;

#define MAX(a, b) (a < b ? b : a)
#define MIN(a, b) (b < a ? b : a)

int main(int argc, char* argv[])
{
	//FILE *f = fopen("in.txt", "r");
	FILE *f = stdin;
	int n;
	fscanf(f, "%d", &n);
	int k = n / 2;
	for (int i = 0; i < n; i++) {
		int ot;
		if (i <= k)
			ot = k - i;
		if (i > k)
			ot = i - k;
		for (int j = 0; j < n; j++) {
			if (j >= ot && j < n - ot)
				printf("D");
			else
				printf("*");
		}
		printf("\n");
	}
	return 0;
}


#include <iostream>
#include <string>
#include <iomanip>
#include <math.h>
#include <fstream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long int
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define PI 3.1415926535
int compare(const void * x1, const void * x2)   // функция сравнения элементов массива
{
  return ( *(int*)x1 - *(int*)x2 );              // если результат вычитания равен 0, то числа равны, < 0: x1 < x2; > 0: x1 > x2
}
double eps = 0.0001;

struct drago
{
    int x,i ;
    bool operator <(const drago a)const
    {
		return x < a.x;				//  > - по убыванию
									//  < - по возрастанию
    }
} m[5];

int nod(int a,int b)
{
	if (b == 0) return a;
	return nod(b,a%b);

}

int main()
{
	int n;
	cin >> n;
	char mas[101][101];
	forn(i,n)
		forn(j,n)
		mas[i][j] = 'D';
	for(int i =0;i<n/2;i++)
		for(int j=0;j<n/2;j++)
		{
			mas[i][j] =
			mas[n-1-i][j] =
			mas[n-1-i][n-1-j] =
			mas[i][n-1-j] = '*';

		}
	forn(i,n)
	{
		forn(j,n)
			cout << mas[i][j];
		cout << endl;

	}
	return 0;
}


#include <iostream>
#include <string>
#include <iomanip>
#include <math.h>
#include <fstream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long int
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define PI 3.1415926535
int compare(const void * x1, const void * x2)   // функция сравнения элементов массива
{
  return ( *(int*)x1 - *(int*)x2 );              // если результат вычитания равен 0, то числа равны, < 0: x1 < x2; > 0: x1 > x2
}
double eps = 0.0001;

struct drago
{
    int x,i ;
    bool operator <(const drago a)const
    {
		return x < a.x;				//  > - по убыванию
									//  < - по возрастанию
    }
} m[5];

int nod(int a,int b)
{
	if (b == 0) return a;
	return nod(b,a%b);

}

int main()
{
	int n;
	cin >> n;
	char mas[101][101];
	forn(i,n)
		forn(j,n)
		mas[i][j] = 'D';
	for(int i =0;i<n/2;i++)
		for(int j=0;j<n/2-i;j++)
		{
			mas[i][j] =
			mas[n-1-i][j] =
			mas[n-1-i][n-1-j] =
			mas[i][n-1-j] = '*';

		}
	forn(i,n)
	{
		forn(j,n)
			cout << mas[i][j];
		cout << endl;

	}
	return 0;
}


#include<iostream>
#include<string>
#include<fstream>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
int  main ()
{
	int n;
    cin>>n;
    for(int i=0;i<n;++i){
        for(int j=0;j<n;++j)
            if(abs(i-n/2)+abs(j-n/2)<=n/2)
                cout<<"D";
            else
               cout<<"*";
		cout<<endl;
	}
	return 0;
}


#include<iostream>
#include<string>
#include<fstream>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
int  main ()
{
int n;
cin>>n;
for ( int i =0;  i<n ;i++)
{
for ( int j =0;  j<n ;j++)
	if (abs(i-n/2)+abs(j-n/2)<=2)
		cout<<"D";
	else
		cout<<"*";
cout<<endl;

}
	return 0 ;
}


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

void print(int x, int n)
{
  for(int i = 0; i< (n-2*x+1)/2 ;i++)
  {
    cout <<"*";
  }
  for(int i=0; i<2*(x-1)+1 ; i++)
  {
    cout <<"D";
  }
  for(int i = 0; i< (n-2*x+1)/2 ;i++)
  {
    cout <<"*";
  }
}
int main() {
	int n;
  cin >> n;
  for(int i=1;i<=n/2;i++)
  {
    print(i,n);
    cout << endl;
  }
  for(int i=0;i<n;i++)
  {
    cout << "D";
  }
  cout << endl;
  for(int i=n/2; i>=1;i--)
  {
    print(i,n);
    cout << endl;
  }
}


#include<iostream>
#include<algorithm>
#include <ctype.h>
#include<string>
#include <cmath>
#include <cstdlib>
#include <map>
using namespace std;
int main() {
   int num;
   cin>>num;
   for(int i=1;i<num; i+=2){
       int x=num-i;
	   cout << std::string(x/2, '*') ;
	   cout<< std::string(i, 'D') ;
	   cout << std::string(x/2, '*')<<"\n" ;
   }
   cout<<std::string(num, 'D') <<"\n" ;
   for(int i=num-2 ; i>=1 ; i-=2){
       int x=num-i;
	   cout << std::string(x/2, '*') ;
	   cout<< std::string(i, 'D') ;
	   cout << std::string(x/2, '*') <<"\n" ;
   }
}


#include <fstream>
#include <iostream>

using namespace std;

ifstream fin("input.txt");
ofstream fout("output.txt");

int main(){
	int n;
	cin >> n;
	int c = n / 2;
	for (int i = 0; i < n / 2; i++)
	{
		for (int j = 0; j < c; j++)
			cout << '*';
		for (int j = 0; j < n - c * 2; j++)
			cout << 'D';
		for (int j = 0; j < c; j++)
			cout << '*';
		c--;
		cout << endl;
	}
	for (int i = 0; i < n; i++)
		cout << 'D';
	cout << endl;
	c = 1;
	for (int i = 0; i < n / 2; i++)
	{
		for (int j = 0; j < c; j++)
			cout << '*';
		for (int j = 0; j < n - c * 2; j++)
			cout << 'D';
		for (int j = 0; j < c; j++)
			cout << '*';
		cout << endl;
		c++;
	}
	cin >> n;
}


#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<functional>
#include<iostream>
#include<cmath>
#include<cctype>
#include<ctime>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=pre[x];p;p=next[p])
#define Lson (x<<1)
#define Rson ((x<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (100000007)
long long mul(long long a,long long b){return (a*b)%F;}
long long add(long long a,long long b){return (a+b)%F;}
long long sub(long long a,long long b){return (a-b+(a-b)/F*F+F)%F;}
typedef long long ll;
int main()
{
//	freopen("Crystal Mine.in","r",stdin);
//	freopen(".out","w",stdout);
	int n;
	cin>>n;
	int t=(n-1)/2,p=(n+1)/2;
	For(i,n)
	{
		For(j,n)
			if (abs(p-i)+abs(p-j)<=t) printf("D");else printf("*");

		cout<<endl;
	}

	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		int i,j,k,m,h=n-2;
		m=n/2+1;
		for(i=1;i<=m;++i)
		{
			for(k=0;k<m-i;++k)
				printf("*");
			for(k=1;k<2*i;++k)
				printf("D");
			for(k=0;k<m-i;++k)
				printf("*");
			printf("\n");
		}
		for(i=m+1;i<=n;i++)
		{
			for(k=m;k<i;k++)
				printf("*");
			for(k=0;k<h;++k)
				printf("D");
			for(k=m;k<i;++k)
				printf("*");
			h-=2;
			printf("\n");
		}
	}
}


#include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;

int main()
{
	int n;
	char dm[101][101];

	cin >> n;
	int first = 0, last = 0, mid = n/2;

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			dm[i][j] = '*';
		}
	}
	int start = 0, end = 0;
	for (int i = 0; i < n; i++)
	{

		if (i <= mid)
		{
			start = mid + first; end = mid + last;
			if ((start >= 0) && (end < n))
			{
				for (int j = start; j <= end; j++)
				{
					dm[i][j] = 'D';
				}
			}
			first -= 1; last += 1;
		}
	}
	first = 1; last = n - 1;

	for (int i = 0; i < n; i++)
	{
		if (i > mid)
		{
			start = first; end = last;
			if ((start >= 0) && (end < n))
			{
				for (int j = start; j < end; j++)
				{
					dm[i][j] = 'D';
				}
			}
			first += 1; last -= 1;
		}
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			cout<<dm[i][j] ;
		}
		cout << endl;
	}

	putchar('\n');
	return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <queue>
#include <functional>
using namespace std;
int main()
{string a[100];
int i,n,j=0,k=1;
cin>>n;
for(i=0;i<n;i++)
{a[0]=a[0]+'*';
}
a[0][n/2]='D';
for(i=1;i<=n/2;i++)
{
	a[i]=a[i-1];
a[i][(n/2)+i]='D';
a[i][(n/2)-i]='D';
}
for(i=((n/2)+1);i<n;i++)
{
	a[i]=a[i-1];
a[i][j]='*';
a[i][n-k]='*';
j++;
k++;
}
for(i=0;i<n;i++)
cout<<a[i]<<endl;}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <queue>
#include <functional>
using namespace std;
int main()
{string a[100000];
long long int i,n,j=0,k=1;
cin>>n;
for(i=0;i<n;i++)
{a[0]=a[0]+'*';
}
a[0][n/2]='D';
for(i=1;i<=n/2;i++)
{
	a[i]=a[i-1];
a[i][(n/2)+i]='D';
a[i][(n/2)-i]='D';
}
for(i=((n/2)+1);i<n;i++)
{
	a[i]=a[i-1];
a[i][j]='*';
a[i][n-k]='*';
j++;
k++;
}

for(i=0;i<n;i++)
cout<<a[i]<<endl;}


#include<iostream>
using namespace std;
int main()
{
    int n;

    //cout << "Iveskite nelygini skaiciu n nemazesni uz 3: ";
    cin >> n;

    // virsutine puse
    for (int i = 1; i <= n; i += 2)
    {
        // "*" pries "D"
        if (i != n)
        {
            for (int x = (n - i) / 2; x > 0; x--)
            {
                cout << "*";
            }
        }
        // "D"
        for (int j = 1; j <= i; j++)
        {
            cout << "D";
        }
        // "*" po "D"
        if (i != n)
        {
            for (int x = (n - i) / 2; x > 0; x--)
            {
                cout << "*";
            }
        }
        cout << endl;
    }

    // apatine puse
    for (int i = (n - 2); i >= 1; i -= 2)
    {
        // "*" pries "D"
        if (i != n)
        {
            for (int x = (n - i) / 2; x > 0; x--)
            {
                cout << "*";
            }
        }
        // "D"
        for (int j = 1; j <= i; j++)
        {
            cout << "D";
        }
        // "*" po "D"
        if (i != n)
        {
            for (int x = (n - i) / 2; x > 0; x--)
            {
                cout << "*";
            }
        }
        cout << endl;
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
	int n;

	cout << "Iveskite n: ";
	cin >> n;

	// virsutine puse
	for (int i = 1; i <= n; i += 2)
	{
		// "*" pries "D"
		if (i != n)
		{
			for (int x = (n - i) / 2; x > 0; x--)
			{
				cout << "*";
			}
		}
		// "D"
		for (int j = 1; j <= i; j++)
		{
			cout << "D";
		}
		// "*" po "D"
		if (i != n)
		{
			for (int x = (n - i) / 2; x > 0; x--)
			{
				cout << "*";
			}
		}
		cout << endl;
	}

	// apatine puse
	for (int i = (n - 2); i >= 1; i -= 2)
	{
		// "*" pries "D"
		if (i != n)
		{
			for (int x = (n - i) / 2; x > 0; x--)
			{
				cout << "*";
			}
		}
		// "D"
		for (int j = 1; j <= i; j++)
		{
			cout << "D";
		}
		// "*" po "D"
		if (i != n)
		{
			for (int x = (n - i) / 2; x > 0; x--)
			{
				cout << "*";
			}
		}
		cout << endl;
	}
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int n;

    cout << "Iveskite n: ";
    cin >> n;

    // virsutine puse
    for (int i = 1; i <= n; i += 2)
    {
        // "*" pries "D"
        if (i != n)
        {
            for (int x = (n - i) / 2; x > 0; x--)
            {
                cout << "*";
            }
        }
        // "D"
        for (int j = 1; j <= i; j++)
        {
            cout << "D";
        }
        // "*" po "D"
        if (i != n)
        {
            for (int x = (n - i) / 2; x > 0; x--)
            {
                cout << "*";
            }
        }
        cout << endl;
    }

    // apatine puse
    for (int i = (n - 2); i >= 1; i -= 2)
    {
        // "*" pries "D"
        if (i != n)
        {
            for (int x = (n - i) / 2; x > 0; x--)
            {
                cout << "*";
            }
        }
        // "D"
        for (int j = 1; j <= i; j++)
        {
            cout << "D";
        }
        // "*" po "D"
        if (i != n)
        {
            for (int x = (n - i) / 2; x > 0; x--)
            {
                cout << "*";
            }
        }
        cout << endl;
    }
    return 0;
}


<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectGuid>{B27806E9-FBE8-4BFE-81C8-169BF00390E7}</ProjectGuid>
    <Keyword>Win32Proj</Keyword>
    <RootNamespace>Crystal</RootNamespace>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v120</PlatformToolset>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v120</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <ImportGroup Label="ExtensionSettings">
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <LinkIncremental>true</LinkIncremental>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <LinkIncremental>false</LinkIncremental>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <PrecompiledHeader>
      </PrecompiledHeader>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>Disabled</Optimization>
      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <SDLCheck>true</SDLCheck>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <PrecompiledHeader>
      </PrecompiledHeader>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <SDLCheck>true</SDLCheck>
    </ClCompile>
    <Link>
      <SubSystem>Console</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup>
    <ClCompile Include="Main.cpp" />
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>
</Project>


#include<iostream>
using namespace std;
int main()
{
    int n;

    //cout << "Iveskite nelygini skaiciu n nemazesni uz 3: ";
    cin >> n;
    while (n < 3)
    {
    //  cout << "Iveskite nelygini skaiciu n nemazesni uz 3: ";
        cin >> n;
    }
    while (n % 2 == 0)
    {
    //  cout << "Iveskite nelygini skaiciu n nemazesni uz 3: ";
        cin >> n;
    }

    // virsutine puse
    for (int i = 1; i <= n; i += 2)
    {
        // "*" pries "D"
        if (i != n)
        {
            for (int x = (n - i) / 2; x > 0; x--)
            {
                cout << "*";
            }
        }
        // "D"
        for (int j = 1; j <= i; j++)
        {
            cout << "D";
        }
        // "*" po "D"
        if (i != n)
        {
            for (int x = (n - i) / 2; x > 0; x--)
            {
                cout << "*";
            }
        }
        cout << endl;
    }

    // apatine puse
    for (int i = (n - 2); i >= 1; i -= 2)
    {
        // "*" pries "D"
        if (i != n)
        {
            for (int x = (n - i) / 2; x > 0; x--)
            {
                cout << "*";
            }
        }
        // "D"
        for (int j = 1; j <= i; j++)
        {
            cout << "D";
        }
        // "*" po "D"
        if (i != n)
        {
            for (int x = (n - i) / 2; x > 0; x--)
            {
                cout << "*";
            }
        }
        cout << endl;
    }
    return 0;
}


#include <iostream>
#include <fstream>
//#include <algorithm>
#include <cstring>

using namespace std;

int main(){
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");

	int n;
	cin >> n;

	int k = n / 2;

	char** arr = new char*[n];
	for(int i = 0; i < n; i ++){
		arr[i] = new char[n];
		for(int j = 0; j < n; j ++){
			arr[i][j] = '*';
		}
	}

	for(int i = 0; i < n; i ++){
		int x;
		if(i > k){
			x = n - 1 - i;
		}else{
			x = i;
		}
		for(int j = k - x; j <= k + x; j ++){
			arr[i][j] = 'D';
		}
	}

	for(int i = 0; i < n; i ++){
		for(int j = 0; j < n; j ++){
			cout << arr[i][j];
		}
		cout << endl;
	}

	//cin.close();
	//cout.close();
	return 0;
}


#include <iostream>
#include <fstream>
//#include <algorithm>
#include <cstring>

using namespace std;

int main(){
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");

	int n;
	cin >> n;

	int k = n / 2;

	char** arr = new char*[n];
	for(int i = 0; i < n; i ++){
		arr[i] = new char[n];
		for(int j = 0; j < n; j ++){
			arr[i][j] = '*';
		}
	}

	for(int i = 0; i < n; i ++){
		int x;
		if(i > k){
			x = n - 1 - i;
		}else{
			x = i;
		}
		for(int j = k - x; j <= k + x; j ++){
			arr[i][j] = 'D';
		}
	}

	for(int i = 0; i < n; i ++){
		for(int j = 0; j < n; j ++){
			cout << arr[i][j] << ' ';
		}
		cout << endl;
	}

	//cin.close();
	//cout.close();
	return 0;
}


#include <iostream>

using namespace std;

int main(){
 int n;
 cin >> n;
  int a=(n-1)/2;
  int c=a;
 for(int i=1; i<=n; i++){
  int b=n-2*a;
 for(int j=1; j<=a; j++){cout<<'.';}
 for(int j=1; j<=b; j++){cout<<'D';}
 for(int j=1; j<=c; j++){cout<<'.';}
  if(n%2==1){
   if(i<=n/2){a--; c--;}
   else{a++; c++;}
  }else{
   if(i<n/2){a--; c--;}
   else if(i>n/2){a++; c++;}
    }
  cout<<"\n";
 }
 return 0;
}


#include <iostream>

using namespace std;

int main(){
 int n;
 cin >> n;
  int a=(n-1)/2;
  int c=a;
 for(int i=1; i<=n; i++){
  int b=n-2*a;
 for(int j=1; j<=a; j++){cout<<'*';}
 for(int j=1; j<=b; j++){cout<<'D';}
 for(int j=1; j<=c; j++){cout<<'*';}
  if(n%2==1){
   if(i<=n/2){a--; c--;}
   else{a++; c++;}
  }else{
   if(i<n/2){a--; c--;}
   else if(i>n/2){a++; c++;}
    }
  cout<<"\n";
 }
 return 0;
}


#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <vector>
#include <stack>
#include <algorithm>
#include <string>
#include <set>
#include <iomanip>
#include <memory.h>
using namespace std;

int main (void){
	//freopen("i.txt","r",stdin);
	//freopen("o.txt", "w+", stdout);

}


#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <vector>
#include <stack>
#include <algorithm>
#include <string>
#include <set>
#include <iomanip>
#include <memory.h>
using namespace std;

int main (void){
	//freopen("i.txt","r",stdin);
	//freopen("o.txt", "w+", stdout);

	int n, i, k=1;
	cin >> n;

	for(i=0; i<(n/2)+1; i++) {

		int j=(n-k)/2;
		while(j--) cout << '*';
		for(j=0; j<k; j++) cout << 'D';
		j=(n-k)/2;
		while(j--) cout << '*';
		cout << "\n";

		k+=2;
	}

	for(k-=4; i<n; i++) {

		int j=(n-k)/2;
		while(j--) cout << '*';
		for(j=0; j<k; j++) cout << 'D';
		j=(n-k)/2;
		while(j--) cout << '*';
		cout << "\n";

		k-=2;
	}
}


#include <iostream>
using namespace std;
int main(){
	int n,a=1,b;
	cin>>n;
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			b=n-a;
			if(j<b/2 || j>n-b/2-1) cout<<"*";
			else cout<<"D";
		}
		if(i<n/2) a+=2;
		else a-=2;
		cout<<endl;
	}
}


#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<iomanip>
#include<vector>
#define F(i,n) for(int (i)=0;(i)<(n);++(i))
#define F1(i,n) for(int (i)=1;(i)<=(n);++(i))
#define ll long long
using namespace std;
void fast_in_out() {
	std::ios_base::sync_with_stdio(NULL);
	cin.tie(NULL); cout.tie(NULL);
}
int main() {
	fast_in_out();
	//cout << fixed << setprecision(0);
	int n; char x[102][102]; cin >> n; int c = 0, m = 0;
	F(i, n)F(j, n)x[i][j] = '*';
	for (int i = 0; i < n; i++)
	{
		x[i][n / 2] = 'D';
		if (m == 0)
			for (int j = 1; j <= c; j++)
			{
				x[i][n / 2 - j] = 'D';
				x[i][n / 2 + j] = 'D';
			}
		if (c > n / 2) m = 1;
		c++;
	}
	int b = 0;
	for (int i = n - 1; i > n / 2; i--)
	{
		for (int j = 0; j < n; j++)
		{
			x[i][j] = x[b][j];
		}
		b++;
	}
	F(i, n){F(j, n)cout << x[i][j]; cout << endl;
}
	return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<iomanip>
#include<vector>
#define F(i,n) for(int (i)=0;(i)<(n);++(i))
#define F1(i,n) for(int (i)=1;(i)<=(n);++(i))
#define ll long long
using namespace std;
void fast_in_out() {
	std::ios_base::sync_with_stdio(NULL);
	cin.tie(NULL); cout.tie(NULL);
}
int main() {
	fast_in_out();
	//cout << fixed << setprecision(0);
	int n; char x[102][102]; cin >> n; int c = 0;
	F(i, n)F(j, n)x[i][j] = '*';
	for (int i = 0; i < n; i++)
	{
		x[i][n / 2] = 'D';
		if (m == 0)
			for (int j = 1; j <= c; j++)
			{
				x[i][n / 2 - j] = 'D';
				x[i][n / 2 + j] = 'D';
			}
		c++;
	}
	int b = 0;
	for (int i = n - 1; i > n / 2; i--)
	{
		for (int j = 0; j < n; j++)
		{
			x[i][j] = x[b][j];
		}
		b++;
	}
	F(i, n){F(j, n)cout << x[i][j]; cout << endl;
}

	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
void pr(int n);
void prob(int n);
int main()
{
  int n,k(1);
  cin >> n;
  for (int i=1;i<=n;i+=2)
  {
     pr((n-i)/2);
     prob(i);
	 pr((n-i)/2);
	 cout << endl;
  }

  for (int i=n-2;i>=1;i-=2)
  {
     pr((n-i)/2);
     prob(i);
	 pr((n-i)/2);
	 cout << endl;
  }

  //cout << endl;
  return 0;
}
void pr(int n)
{
  for (int i=1;i<=n;i++) cout <<"D";
  //cout << n;
  //for (int i=n-1;i>0;i--) cout <<i<<" ";
 //  cout << endl;
}
void prob(int n)
{
  for (int i=1;i<=n;i++) cout << "*";
}


#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
void pr(int n);
void prob(int n);
int main()
{
  int n,k(1);
  cin >> n;
  for (int i=1;i<=n;i+=2)
  {
     pr((n-i)/2);
     prob(i);
	 pr((n-i)/2);
	 cout << endl;
  }

  for (int i=n-2;i>=1;i-=2)
  {
     pr((n-i)/2);
     prob(i);
	 pr((n-i)/2);
	 cout << endl;
  }

  //cout << endl;
  return 0;
}
void pr(int n)
{
  for (int i=1;i<=n;i++) cout <<"*";
  //cout << n;
  //for (int i=n-1;i>0;i--) cout <<i<<" ";
 //  cout << endl;
}
void prob(int n)
{
  for (int i=1;i<=n;i++) cout << "D";
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <iomanip>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#define ll long long
using namespace std;

const ll max1 = 101;

int main() {
	char a[51][51];
	bool debug =false;
	int otkl = 0;
	if (debug) {
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}
	int n;
	cin >> n;
	for (size_t i = 0; i < (n+1)/2; i++)
	{
		for (size_t j = 0; j < n; j++)
		{
			if ((j <= ((n - 1) / 2) + otkl) && (j >= ((n - 1) / 2) - otkl))
			{
				a[i][j] = 'D';
				cout << a[i][j];
			}
			else
			{
				a[i][j] = '*';
				cout << a[i][j];
			}
		}
		cout << endl;
		otkl++;
	}

	ll nas = ((n - 1) / 2) - 1;
	for (ll i = nas; i >= 0; i--)
	{
		for (size_t j = 0; j < n; j++)
		{
			cout << a[i][j];
		}
		cout << endl;
	}
	return 0;

}
/*vector<long long>::iterator point = max_element(a.begin(), a.end());
long long dist = distance(a.begin(), point);*/


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <iomanip>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#define ll long long
using namespace std;

const ll max1 = 101;

int main() {
	char a[51][101];
	bool debug =false;
	int otkl = 0;
	if (debug) {
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}
	int n;
	cin >> n;
	for (size_t i = 0; i < (n+1)/2; i++)
	{
		for (size_t j = 0; j < n; j++)
		{
			if ((j <= ((n - 1) / 2) + otkl) && (j >= ((n - 1) / 2) - otkl))
			{
				a[i][j] = 'D';
				cout << a[i][j];
			}
			else
			{
				a[i][j] = '*';
				cout << a[i][j];
			}
		}
		cout << endl;
		otkl++;
	}

	ll nas = ((n - 1) / 2) - 1;
	for (ll i = nas; i >= 0; i--)
	{
		for (size_t j = 0; j < n; j++)
		{
			cout << a[i][j];
		}
		cout << endl;
	}
	return 0;

}
/*vector<long long>::iterator point = max_element(a.begin(), a.end());
long long dist = distance(a.begin(), point);*/


#include<iostream>
#include<string>
using namespace std;

int main()
{

	int n;
	cin>>n;
	int p=n/2;
	int num=1;
	for(int i=0 ; i<n ;i++)
	{
		for(int j=0  , count=0; count<n;j++)
		{
			if(j==p)
			{
				int a=1;
				while(a<=num)
				{
					cout<<"D";
					count++;
					a++;
				}
			}
			else
			{
				cout<<"*";
				count++;
			}
		}
		if(i<n/2)
		{
			p--;
			num+=2;
		}
		else
		{
			p++;
			num-=2;
		}

		cout<<endl;
	}
	return 0;
}


// 300000.cpp: ���������� ����� ����� ��� ����������� ����������.
//

//#include "stdafx.h"
#include <iostream>

int main()
{
	int number;
	std::cin>>number;
	for(int i = 0; i < number/2; i ++)
	{
		for(int j = (number)/2 - i ; j > 0;j--)
			std::cout<<"*";
		for(int k = 0; k < 2*i + 1; k++)
			std::cout<<"D";
		for(int j = (number)/2 - i ; j > 0;j--)
			std::cout<<"*";
		std::cout<<std::endl;
	}
	for(int i = 0; i < number; i++)
		std::cout << "D";
	std::cout<<std::endl;
	for(int i = number/2 - 1; i >= 0; i --)
	{
		for(int j = 0; j < number/2 - i ;j++)
			std::cout<<"*";
		for(int k = 0; k < 2*i + 1; k++)
			std::cout<<"D";
		for(int j = 0; j < number/2 - i ;j++)
			std::cout<<"*";
		std::cout<<std::endl;
	}
	return 0;
}


// 300000.cpp: ���������� ����� ����� ��� ����������� ����������.
//

//#include "stdafx.h"
#include <iostream>

int main()
{
	int number;
	std::cin>>number;
	for(int i = 0; i < number/2; i ++)
	{
		for(int j = (number - 1)/2; j > 0;j--)
			std::cout<<"*";
		for(int k = 0; k < i + 1; k++)
			std::cout<<"D";
		for(int j = (number - 1)/2; j > 0;j--)
			std::cout<<"*";
		std::cout<<std::endl;
	}
	for(int i = 0; i < number; i++)
		std::cout << "D";
	std::cout<<std::endl;
	for(int i = 0; i < number/2; i ++)
	{
		for(int j = (number - 1)/2; j > 0;j--)
			std::cout<<"*";
		for(int k = 0; k < i + 1; k++)
			std::cout<<"D";
		for(int j = (number - 1)/2; j > 0;j--)
			std::cout<<"*";
		std::cout<<std::endl;
	}
	return 0;
}


// 300000.cpp: ���������� ����� ����� ��� ����������� ����������.
//

//#include "stdafx.h"
#include <iostream>

int main()
{
	int number;
	std::cin>>number;
	for(int i = 0; i <= number/2; i ++)
	{
		for(int j = (number)/2 - i + 1; j > 0;j--)
			std::cout<<"*";
		for(int k = 0; k < i + 1; k++)
			std::cout<<"D";
		for(int j = (number)/2 - i + 1; j > 0;j--)
			std::cout<<"*";
		std::cout<<std::endl;
	}
	for(int i = 0; i < number; i++)
		std::cout << "D";
	std::cout<<std::endl;
	for(int i = number/2; i >= 0; i --)
	{
		for(int j = 0; j < number/2 - i + 1;j++)
			std::cout<<"*";
		for(int k = 0; k < i + 1; k++)
			std::cout<<"D";
		for(int j = 0; j < number/2 - i + 1;j++)
			std::cout<<"*";
		std::cout<<std::endl;
	}
	return 0;
}


// 300000.cpp: ���������� ����� ����� ��� ����������� ����������.
//

#include "stdafx.h"
#include <iostream>

int main()
{
	int number;
	std::cin>>number;
	for(int i = 0; i <= number/2; i ++)
	{
		for(int j = (number)/2 - i + 1; j > 0;j--)
			std::cout<<"*";
		for(int k = 0; k < i + 1; k++)
			std::cout<<"D";
		for(int j = (number)/2 - i + 1; j > 0;j--)
			std::cout<<"*";
		std::cout<<std::endl;
	}
	for(int i = 0; i < number; i++)
		std::cout << "D";
	std::cout<<std::endl;
	for(int i = number/2; i >= 0; i --)
	{
		for(int j = 0; j < number/2 - i + 1;j++)
			std::cout<<"*";
		for(int k = 0; k < i + 1; k++)
			std::cout<<"D";
		for(int j = 0; j < number/2 - i + 1;j++)
			std::cout<<"*";
		std::cout<<std::endl;
	}
	return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
void output(int i);
int i, n, j, pos, num;
int main()
{
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		output(i);
	}
	system("PAUSE");
	return 0;
}
void output(int i)
{
	int fi;
	if (i>n / 2 + 1){ fi = n - i+1; }
	else{ fi = i; }
	num = 2 * (fi - 1) + 1;
	pos = n / 2 + 1 - fi;
	for (j = 0; j < n; j++)
	{
		if (j >= pos&&j < pos + num)cout << "D";
		else cout << "*";
	}
	cout << endl;
}


#include<iostream>
#include<algorithm>
using namespace std;
void output(int i);
int i, n, j, pos, num;
int main()
{
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		output(i);
	}
	return 0;
}
void output(int i)
{
	int fi;
	if (i>n / 2 + 1){ fi = n - i+1; }
	else{ fi = i; }
	num = 2 * (fi - 1) + 1;
	pos = n / 2 + 1 - fi;
	for (j = 0; j < n; j++)
	{
		if (j >= pos&&j < pos + num)cout << "D";
		else cout << "*";
	}
	cout << endl;
}


#include <iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<stdio.h>
using namespace std;
main()
{
    int n;
    cin>>n;
    int x=1;
    int y=n/2;
    int z=0;
    for(int i=1;i<=y;i++)
    {
        for(int j=z;j<y;j++)
        {
            cout<<"*";
        }
        for(int j=0;j<x;j++)
        {
            cout<<"D";
        }
        for(int j=z;j<y;j++)
        {
            cout<<"*";
        }
        x=x+2;
        z=z+1;
        cout<<endl;
    }
    for(int i=0;i<n;i++)
    {
        cout<<"D";
    }
    cout<<endl;
    z=z-1;
    x=x-2;
    for(int i=1;i<=y;i++)
    {
        for(int j=z;j<y;j++)
        {
            cout<<"*";
        }
        for(int j=0;j<x;j++)
        {
            cout<<"D";
        }
        for(int j=z;j<y;j++)
        {
            cout<<"*";
        }
        x=x-2;
        z=z-1;
        cout<<endl;
    }
    return 0;
}


#include <iostream>
#include<algorithm>
#include<math.h>
#include<string>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int x=1;
    int y=n/2;
    int z=0;
    for(int i=1;i<=y;i++)
    {
        for(int j=z;j<y;j++)
        {
            cout<<"*";
        }
        for(int j=0;j<x;j++)
        {
            cout<<"D";
        }
        for(int j=z;j<y;j++)
        {
            cout<<"*";
        }
        x=x+2;
        z=z+1;
        cout<<endl;
    }
    for(int i=0;i<n;i++)
    {
        cout<<"D";
    }
    cout<<endl;
    z=z-1;
    x=x-2;
    for(int i=1;i<=y;i++)
    {
        for(int j=z;j<y;j++)
        {
            cout<<"*";
        }
        for(int j=0;j<x;j++)
        {
            cout<<"D";
        }
        for(int j=z;j<y;j++)
        {
            cout<<"*";
        }
        x=x-2;
        z=z-1;
        cout<<endl;
    }
    return 0;
}


#include<iostream>
using namespace std;
class draw_crystal
{
public:
    explicit draw_crystal(const int);
    void draw()const;
private:
    const int N;
};
inline draw_crystal::draw_crystal(const int n)
:N(n)
{
}
inline void draw_crystal::draw() const
{
    for(int i=0;i<N;i++)
    {
        for(int j=0;j<N;j++)
        {
            if(j>=N/2-i&&j<=N/2+i&&i<=N/2)
                cout <<'D';
            else if(i>N/2&&j>=N/2-(N-(i+1))&&j<=N/2+(N-(i+1)))
                cout <<'D';
            else
                cout <<'*';

        }
        cout <<endl;
    }
}
int main()
{
    int n;
    cin>>n;
    if(n<3||n>101||n%2==0)
        return 0;
    draw_crystal d(n);
    d.draw();
    system("pause");
    return 0;
}


#include<iostream>
using namespace std;
class draw_crystal
{
public:
    explicit draw_crystal(const int);
    void draw()const;
private:
    const int N;
};
inline draw_crystal::draw_crystal(const int n)
:N(n)
{
}
inline void draw_crystal::draw() const
{
    for(int i=0;i<N;i++)
    {
        for(int j=0;j<N;j++)
        {
            if(j>=N/2-i&&j<=N/2+i&&i<=N/2)
                cout <<'D';
            else if(i>N/2&&j>=N/2-(N-(i+1))&&j<=N/2+(N-(i+1)))
                cout <<'D';
            else
                cout <<'*';

        }
        cout <<endl;
    }
}
int main()
{
    int n;
    cin>>n;
    if(n<3||n>101||n%2==0)
        return 0;
    draw_crystal d(n);
    d.draw();
    return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
	int n;
	while(scanf("%d", &n)!=EOF)
	{
		int i, j, I, J;
		for(i=0;i<n;i++)
		{
			for(j=0;j<n;j++)
			{
				I = i>(n-1)/2?(n-1)-i:i;
				J = j>(n-1)/2?(n-1)-j:j;
				if(I+J+1>=(n+1)/2)
					printf("D");
				else
					printf("*");
			}
			printf("\n");
		}
	}
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		int i,j,k,m,h=n-2;
		m=n/2+1;
		for(i=1;i<=m;++i)
		{
			for(k=0;k<m-i;++k)
				printf("*");
			for(k=1;k<2*i;++k)
				printf("D");
			for(k=0;k<m-i;++k)
				printf("*");
			printf("\n");
		}
		for(i=m+1;i<=n;i++)
		{
			for(k=m;k<i;k++)
				printf("*");
			for(k=0;k<h;++k)
				printf("D");
			for(k=m;k<i;++k)
				printf("*");
			h-=2;
			printf("\n");
		}
	}
}


#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stdlib.h>
#include<algorithm>
//#define f(n) 2*n
using namespace std;
int main()
{
	int num;
	int x, y, i, j;
	scanf("%d", &num);
	for (i = 1; i <num/2+1; i++)
	{
		x = 2*(i - 1) + 1;
		y = num - x;
		for (j = 1; j <=num; j++)
		{
			if (j <= (num - x) / 2)
				printf("*");
			else if (j <= (num + x) / 2)
				printf("D");
			else if (j < num)
				printf("*");
		}
		printf("*\n");
	}
	for (j = 0; j < num-1; j++)
	{
		printf("D");
	}
	printf("D\n");
	for (i = num/2; i >=1; i--)
	{
		x = 2 * (i - 1) + 1;
		y = num - x;
		for (j = 1; j <= num; j++)
		{
			if (j <= (num - x) / 2)
				printf("*");
			else if (j <= (num + x) / 2)
				printf("D");
			else if (j < num)
				printf("*");
		}
		printf("*\n");
	}

}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cassert>
#include <queue>
#include <stack>

#define x first
#define y second
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> point;
typedef pair<ll, ll> pll;
typedef pair<ld, int> pdi;

const int N = (int)(1e5) + 7;
const int M = (int)(1e6);
const ld eps = 1e-12;
const ll MOD = (ll)(1e9) + 7;
const ll INF = (ll)(1e9) + 7;
const ld PI = 3.14159265358979310000;

int a[N];

int main()
{
    //freopen("people.in", "r", stdin);
    //freopen("people.out", "w", stdout);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    int l = 0, r = n - 1, ta = 0, tb = 0, kola = 0, kolb = 0;
    while (l <= r)
    {
        if (ta <= tb)
        {
            ta += a[l];
            ++kola;
            ++l;
        }
        else
        {
            tb += a[r];
            kolb++;
            --r;
        }
    }
    cout << kola << ' ' << kolb << endl;
    return 0;
}


#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <climits>
#include <iomanip>
#include <bitset>
#include <list>
#include <deque>
#include <utility>
#include <functional>
#include <cassert>

using namespace std;

#define all(a)              (a).begin(), (a).end()
#define ms(a,b)             memset(a, b, sizeof(a))
#define mp                  make_pair
#define pb                  push_back
#define fore(it,a)          for (auto it = (a).begin(), it##_ = (a).end(); it != it##_; it++)
#define f0r(i, a)           for (int i = 0, i##_ = (a); i < i##_; i++)
#define debug(args...)      do {cerr << #args << ": "; dbg,args; cerr << endl;} while(0)
#define read(type, args...) type args; rdr,args;
#define fi                  first
#define se                  second
#define bit_no              __builtin_popcount
#define left(a)             (2*(a))
#define right(a)            (2*(a)+1)
#define mid(left, right)    (((left)+(right))/2+1)

typedef long long               ll;
typedef long double             ld;
typedef unsigned long long      ull;
typedef vector<int>             vi;
typedef vector<vi>              vvi;
typedef pair<int, int>          ii;
typedef tuple<int, int, int>    iii;
typedef vector<ii>              vii;
typedef vector<iii>             viii;

const int inf = 2e8+5;
const ll l_inf = 9e18+5;
const int mod_v = 1e9+7;
const int max_n = 1e5+5;

template<typename T>
T gcd(T a, T b)
{
    while (b) {
        T temp = a % b;
        a = b;
        b = temp;
    }
    return a;
}

template<typename T>
tuple<T, T, T> egcd(T a, T b)
{
    T x1 = 1, x2 = 0, y1 = 0, y2 = 1;
    while (b) {
        T q = a / b, r = a % b;
        T new_x = x1 - q*x2, new_y = y1 - q*y2;
        x1 = x2, y1 = y2, x2 = new_x, y2 = new_y;
        a = b, b = r;
    }
    return make_tuple(a, x1, y1);
}

inline ll lcm(ll a, ll b)
{
    return a*b/gcd(a, b);
}

template<typename T>
inline T mod(T a, T b = mod_v)
{
    return (a % b + b) % b;
}

template<typename T>
inline T mod_inv(T a, T b = mod_v)
{
    return mod(get<1>(egcd(a, b)), b);
}

template<typename T>
inline T sum(T a, T b, T m = mod_v)
{
    return mod(mod(a, m) + mod(b, m), m);
}

template<typename T>
inline T difference(T a, T b, T m = mod_v)
{
    return mod(mod(a, m) - mod(b, m), m);
}

inline ll product(ll a, ll b, ll m = mod_v)
{
    return mod(mod(a, m) *  mod(b, m), m);
}

inline ll quotient(ll a, ll b, ll m = mod_v)
{
    return mod(mod(a, m) * mod_inv(b, m), m);
}

template<typename T,typename T2>
ostream& operator<< (ostream &s, const pair<T,T2> &p) {return s << p.fi << ' ' << p.se << ' ';}

template<typename T,typename T2>
istream& operator>> (istream &s, pair<T,T2> &p) {return s >> p.fi >> p.se;}

template<typename T>
ostream& operator<< (ostream &s, const vector<T> &v)  {for (auto it: v) s << it << ' '; return s;}

template<typename T>
istream& operator>> (istream &s, vector<T> &v) {fore (it, v) s >> *it; return s;}

template<typename T>
void read_range(T beg, T end)
{
    while (beg != end)
        cin >> *beg++;
}

template<typename T>
void print_range(T beg, T end)
{
    while (beg != end)
        cout << *beg++ << ' ';
}

struct reader
{
    template<typename T>
    reader& operator, (T &v)
    {
        cin >> v;
        return *this;
    }
} rdr;

struct debugger
{
    template<typename T>
    debugger& operator, (const T &v)
    {
        cerr << v << ", ";
        return *this;
    }
} dbg;

/***************************************************************
----------------------------------------------------------------
----------------------------------------------------------------
***************************************************************/

int ar[max_n];
int b_time[max_n];
int a_time[max_n];

int main()
{
    ios_base::sync_with_stdio(false);

    read(int, n);
    read_range(ar, ar+n);

    a_time[0] = 0;
    b_time[n-1] = 0;
    for (int i = 1; i < n; i++) {
        a_time[i] = a_time[i-1] + ar[i-1];
        b_time[n-i-1] = b_time[n-i] + ar[n-i];
    }

    int a_count = 0, b_count = 0;
    f0r (i, n)
        if (a_time[i] <= b_time[i])
            a_count++;
        else
            b_count++;

    cout << a_count << ' ' << b_count;

    return 0;
}