//GIVE ME AC!!!!!!!!!!!!!!!!!
//#pragma GCC target("avx")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define floatset() fixed<<setprecision(15)
#define all(n) n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
#define rep(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define pb push_back
#define eb emplace_back
#define INT(...) int __VA_ARGS__;scan(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;scan(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;scan(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;scan(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;scan(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;scan(__VA_ARGS__)
using namespace std;
using vl=vector<ll>;
using vi=vector<int>;
using vs=vector<string>;
using vc=vector<char>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using vvc=vector<vc>;
using vd=vector<double>;
using vp=vector<P>;
using vb=vector<bool>;
using P=pair<ll,ll>;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const ll inf =1e18;
const ll MOD=1000000007;
const ll mod=998244353;
const double pi=acos(-1);
template<typename T1,typename T2 >
ostream &operator<<(ostream&os,const pair<T1,T2>&p) {
  os<<p.first<<" "<<p.second;
  return os;
}
template<typename T1,typename T2>
istream &operator>>(istream&is,pair<T1,T2>&p) {
  is>>p.first>>p.second;
  return is;
}
template<typename T>
ostream &operator<<(ostream&os,const vector<T>&v) {
  for(int i=0;i<(int)v.size();i++) {
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  return os;
}
template<typename T>
istream &operator>>(istream&is,vector<T>&v) {
  for(T &in:v)is>>in;
  return is;
}
void scan(){}
template<class Head,class... Tail>
void scan(Head&head,Tail&... tail) {
  cin>>head;
  scan(tail...);
}
template<class T>
void print(const T &t) { cout << t << '\n'; }
template<class Head, class... Tail>
void print(const Head &head, const Tail &... tail) {
  cout << head << ' ';
  print(tail...);
}
template<class... T>
void fin(const T &... a) {
  print(a...);
  exit(0);
}
template<typename T1,typename T2>
inline bool chmax(T1&a,T2 b){return a<b&&(a=b,true);}
template<typename T1,typename T2>
inline bool chmin(T1&a,T2 b){return a>b&&(a=b,true);}
int main(){
  LL(n,m);
  vs a(m);
  cin>>a;
  sort(all(a));
  ll now=0;
  rep(i,0,n){
    ll cnt=0;
    while(cnt+a[now].size()<=n){
      cnt+=a[now].size();
      cout<<a[now];
      now++;
    }
    rep(i,0,n-cnt){
      cout<<".";
    }
    cout<<endl;
  }
}
#pragma region
#ifdef LOCAL
#include "pch.h"
#else
#include <bits/stdc++.h>
#endif

// debug
template<typename ... Types>
void __read(Types& ... args) {
  ((std::cin >> args), ...);
}
#define read(type, ...) type  __VA_ARGS__; __read(__VA_ARGS__)

template <typename T>
std::istream &operator>>(std::istream &in, std::vector<T>& v) {
  int n = v.size();
  for(int i = 0; i < n; i++) in >> v[i];
  return in;
}

template <typename Type, typename... Types>
auto print(Type const &arg, Types const &... args) {
  std::cout << arg, ((std::cout << " " << args), ...), std::cout << std::endl;
}
template <typename Type, typename... Types>
auto print_debug(Type const &arg, Types const &... args) {
  std::cout << arg, ((std::cout << " | " << args), ...), std::cout << std::endl;
}
#ifdef LOCAL
#define debug(...) do{std::cout <<  __LINE__ << ": [" << #__VA_ARGS__ << "]: ", print_debug(__VA_ARGS__);}while(0)
#else
#define debug(...) 1
#endif

template<typename T1, typename T2>
std::ostream& operator<<(std::ostream& out, std::pair<T1, T2> const& a) {
  return out << "{" << a.first << ", " << a.second << "}";
}
#define __DEF_PRINTER(container)                                          \
template<typename T>                                                      \
std::ostream& operator<<(std::ostream& out, container<T> const& a)        \
{                                                                         \
  size_t len = a.size();                                                  \
  for(auto x : a) out << x << " \n"[len--==0];                            \
  return out;                                                             \
}
#define __DEF_PRINTER2(container)                                         \
template<typename T, typename T2>                                         \
std::ostream& operator<<(std::ostream& out, container<T, T2> const& a)    \
{                                                                         \
  size_t len = a.size();                                                  \
  for(auto x : a) out << x << " \n"[len--==0];                            \
  return out;                                                             \
}

__DEF_PRINTER(std::vector)
__DEF_PRINTER(std::set)
__DEF_PRINTER(std::unordered_set)
__DEF_PRINTER2(std::map)
__DEF_PRINTER2(std::unordered_map)
// end debug

#define ALL(container) std::begin(container), std::end(container)
#define RALL(container) std::rbegin(container), std::rend(container)

const char nl = '\n';

template <typename T>
void minmax(T k1, T k2, T& min, T& max) {
  min = std::min(k1, k2);
  max = std::max(k1, k2);
}

template <typename T>
void maxim(T& val, T t) {
  val = std::max(val, t);
}

template <typename T>
void minim(T& val, T t) {
  val = std::min(val, t);
}

const long long mod = 1e9+7;
long long reduce_mod(long long a) {
  return (a % mod + mod) % mod;
}
long long add(long long a, long long b) {
  return reduce_mod(a + b);
}
long long mult(long long a, long long b) {
  return reduce_mod(a * b);
}

template<class Fun>
class y_combinator_result {
    Fun fun_;
public:
    template<class T> explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}
    template<class ...Args> decltype(auto) operator()(Args &&...args) { 
      return fun_(std::ref(*this), std::forward<Args>(args)...); 
    }
};
template<class Fun>
decltype(auto) y_combinator(Fun &&fun) {
  return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));
}

void yn(bool yes) {
  std::cout << (yes ? "yes" : "no") << '\n';
}

using i64 = int64_t;
using namespace std;

#pragma endregion

void run(int tt) {
  (void)tt;
}

int main() {
  cin.tie(0)->sync_with_stdio(false);

  read(i64, n, k);
  i64 q = n/200;
  i64 r = n%200;
  for(int i = 0; i < k; i++) {
    if (r==0) {
      // n = q
      r = q%200;
      q = q/200;
    } else{
      q = (1000*q+5*r+1);
      r = 0;
    }
  }
  print(200*q+r);
}
