#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    string S; cin >> S;
    int A[110];
    for(int i = 0; i < N + 1; i++) {
        cin >> A[i];
    }
    int ans = 100000;
    for(int i = 0; i < N; i++) {
        ans = min(ans, abs(A[i] - A[i + 1]));
    }
    cout << ans << endl;
    for(int i = 0; i < ans; i++) {
        for(int j = 0; j < N + 1; j++) {
            if(j != 0) cout << " ";
            cout << (A[j] + i) / ans;
        }
        cout << endl;
    }


    return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define lli long long int
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define plli pair<lli,lli>
#define vi vector<int>
#define vlli vector<lli>
#define vpi vector<pii>
#define vplli vector<plli>
#define mi map<int,int>
#define mlli map<lli,lli>
#define forl(i,a,b) for(lli i=a;i<b;i++)
#define ford(i,a,b) for(lli i=a;i>=b;i--)
#define cout0(a) cout << a << endl
#define cout1(a) cout << a << " "
#define cout2(a,b) cout << a << " " << b << endl
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl

lli gcd(lli a,lli b)
{
    if(b>a)
    {
      lli t=a;
      a=b;
      b=t;
    }

    while(b!=0)
    {
      lli t = a;
      a = b;
      b = t%b;
    }

    return a;
}

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

void dfs(vlli v[],lli s,lli depth[],lli isvisited[])
{
  forl(i,0,v[s].size())
  {
    lli t=v[s][i];
    if(!isvisited[t])
    {
      depth[t]=depth[s]+1;
      isvisited[t]++;
      dfs(v,t,depth,isvisited);
    }
  }
}

lli nCr(lli n,lli r)
{
  lli p = 1,k = 1;
  if (n-r < r) r = n - r;

  if (r != 0)
  {
    while (r)
    {
      p*=n;
      k*=r;

      lli m = __gcd(p, k);

      p/=m;
      k/=m;

      n--;
      r--;
    }
  }
  else p = 1;

  return p;
}

lli SieveOfEratosthenes(lli n)
{
  bool prime[n+1];
  memset(prime,true,n+1);
  forl(i,2,n+1)
    if(prime[i])
      for(lli j=2*i;j<n+1;j+=i)
        prime[i]=false;

  lli count=0;
  forl(i,2,n+1)
    if(prime[i]) count++;
  return count;
}

int main()
{
  fastio;
  // time_t start, end;
  // time(&start);

  lli q;
  // cin >> q;
  q = 1;
  while(q--)
  {
    lli h,w;
    cin >> h >> w;

    char grid[h+1][w+1];

    forl(i,1,h+1)
    {
      forl(j,1,w+1)
      {
        cin >> grid[i][j];
      }
    }

    lli starter[h+1][w+1];
    lli opponent[h+1][w+1];

    ford(j,w,1)
    {
      ford(i,h,1)
      {
        lli s_d = INT_MIN,s_r = INT_MIN, o_d = 0, o_r = 0;

        if(i==h && j==w)
        {
          starter[i][j] = 0;
          opponent[i][j] = 0;
        }
        else
        {
          if(i<h)
          {
            if(grid[i+1][j] == '+') s_d = 1+opponent[i+1][j];
            else s_d = -1+opponent[i+1][j];
            o_d = starter[i+1][j];
          }

          if(j<w)
          {
            if(grid[i][j+1] == '+') s_r = 1+opponent[i][j+1];
            else s_r = -1+opponent[i][j+1];
            o_r = starter[i][j+1];
          }

          if(s_d-o_d > s_r-o_r)
          {
            starter[i][j] = s_d;
            opponent[i][j] = starter[i+1][j];
          }
          else
          {
            starter[i][j] = s_r;
            opponent[i][j] = starter[i][j+1];
          }
        }
      }
    }

    if(starter[1][1] > opponent[1][1]) cout0("Takahashi");
    else if(starter[1][1] < opponent[1][1]) cout0("Aoki");
    else cout0("Draw");
  }

  // time(&end);
  // cout<<fixed<<double(end - start)<<setprecision(10)<<endl;
}
