#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<ctime>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<bitset>
#include<functional>
#include <fstream>
//#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rep(i, x) for(ll i = 0; i < x; i++)
#define rep2(i, x) for(ll i = 1; i <= x; i++)
#define rep3(i, x, y) for(ll i = x; i < y; i++)
#define rep4(i, x) for(ll i = x; i >= 0; i--)
#define all(a) (a).begin(),(a).end()
#define puts(x) cout << (x) << "\n"
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const int intINF = 1000000000;
const ll mod = 1000000007;
const ll MOD = 998244353;
const ld pi = 3.141592653589793238;
//const ld EPS = 1e-9;

bool isprime(int p) {
	if (p == 1) return false;
	for (int i = 2; i < p; i++) {
		if (p % i == 0) return false;
	}
	return true;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
//main関数内に extGCD(a, b, x, y); でx, yに解が格納
ll extGCD(ll a, ll b, ll& x, ll& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	ll d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll keta(ll n) {
	ll res = 0;
	while (n >= 1) {
		res += n % 10; n /= 10;
	}
	return res;
}
ll modpow(ll x, ll y) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= mod; }
		x = x * x % mod; y /= 2;
	}
	return res;
}
ll nCk(ll n, ll k) {
	ll a = 1, b = 1;
	for (int h = n - k + 1; h <= n; h++) { a *= h; a %= mod; }
	for (int h = 1; h <= k; h++) { b *= h; b %= mod; }
	return a * modpow(b, mod - 2) % mod;
}
//printf("%.10f\n", n);
typedef pair <ll, ll> P;
typedef pair <ld, ll> pp;
ll dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
struct edge { ll to, cost; };
struct status {
	ll ima;
	ll cost;

	bool operator<(const status& rhs) const { return cost < rhs.cost; };
	bool operator>(const status& rhs) const { return cost > rhs.cost; };
};



int main() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	//cout << fixed << setprecision(15);

	//input
	ll n; string s; cin >> n >> s;
	vector<ll>a(n + 1); ll mi = INF;
	rep(i, n + 1) {
		cin >> a[i]; //mi = min(mi, a[i]);
	}
	rep(i, n) {
		if (s[i] == '<') {
			mi = min(mi, a[i + 1] - a[i]);
		}
		else {
			mi = min(mi, a[i] - a[i + 1]);
		}
	}
	vector<vector<ll>> ans(n + 2, vector<ll>(10002));
	rep(i, n + 1) {
		ll cnt = a[i];
		rep(j, mi) {
			ans[i][j] = cnt / (mi - j); cnt -= ans[i][j];
		}
	}
	cout << mi << endl;
	rep(j, mi) {
		rep(i, n + 1) {
			if (i != 0) { cout << ' '; }
			cout << ans[i][j];
		}
		cout << endl;
	}
	return 0;
}
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<sstream>
#include<cstring>
#include<cstdio>
#include<string>
#include<deque>
#include<cmath>
#include<queue>
#include<set>
#include<map>

using namespace std;

struct Diff {
	int thePos;
	long long rPos;
	long long rNeg;
	long long max;
	
	long long a;
	long long b;
	
	int d;
};

Diff diffs[100010];

int k;
long long n, m;
//long long a[100010];
//long long rPos[100010];
//long long rNeg[100010];
//
//long long b[100010];

bool compare(const Diff &a, const Diff &b) {
	if (a.max == b.max) {
		return a.thePos < b.thePos;
	} else {
		return a.max > b.max;
	}
}

bool comparePos(const Diff &a, const Diff &b) {
	return a.thePos < b.thePos;
}

int main(void)
{
	scanf("%lld%lld%lld", &k, &n, &m);
	for (int i = 0 ; i < k ; i++) {
		scanf("%lld", &(diffs[i].a));
		diffs[i].rPos = diffs[i].a * m % n;
		diffs[i].rNeg = n - diffs[i].rPos;
		diffs[i].thePos = i;
		
		//似乎不会有相等额情况 
		if (diffs[i].rPos > diffs[i].rNeg) {
			diffs[i].max = diffs[i].rPos;
		} else {
			diffs[i].max = diffs[i].rNeg;
		}
	}
	
	sort(diffs, diffs + k, compare);
	long long balance = 0;
	//balance的值是固定的！ 
	for (int i = 0 ; i < k ; i++) {
		//似乎不会有相等额情况
		if (diffs[i].rPos < diffs[i].rNeg) {
			diffs[i].d = 1;	//正向 
			balance = balance + diffs[i].rPos;
		} else {	//负向 
			diffs[i].d = -1;
			balance = balance - diffs[i].rNeg;
		}
	}
	
	int pPos = k - 1;
	if (balance > 0) {
		while (balance > 0) {
			if (diffs[pPos].d == 1) {
				diffs[pPos].d = -1;
				balance = balance - n;
			}
			pPos--;
		}
	} else if (balance < 0) {
		while (balance < 0) {
			if (diffs[pPos].d == -1) {
				diffs[pPos].d = 1;
				balance = balance + n;
			}
			pPos--;
		}		
	}
	
	sort(diffs, diffs + k, comparePos);
	for (int i = 0 ; i < k ; i++)  {
		diffs[i].b = diffs[i].a * m / n;
		
		if (diffs[i].d < 0) {
			diffs[i].b++;
		}
	}	
	
	for (int i = 0 ; i < k ; i++)  {
		printf("%d ", diffs[i].b);
	}
	printf("\n");
	
	return 0;
}
