#include "bits/stdc++.h"
//#include "atcoder/all"
using namespace std;
//using namespace atcoder;
//using mint = modint1000000007;
//const int mod = 1000000007;
//using mint = modint998244353;
//const int mod = 998244353;
const int INF = 1e9;
//const long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i,l,r)for(int i=(l);i<(r);++i)
#define rrep(i, n) for (int i = (n-1); i >= 0; --i)
#define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i)
#define all(x) (x).begin(),(x).end()
#define allR(x) (x).rbegin(),(x).rend()
#define endl "\n"
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<int>a(n + 1);
	rep(i, n + 1) { cin >> a[i]; }
	int k = INF;
	rep(i, n) { k = min(k, abs(a[i] - a[i + 1])); }
	cout << k << endl;
	rep(i, k) {
		rep(j, n + 1) {
			cout << (a[j] + i) / k << " ";
		}
		cout << endl;
	}
	return 0;
}
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int N; string S; cin >> N >> S;
    vector<int> B(N + 1);
    for (auto &b : B) cin >> b;

    int k = 0;
    REP(i, 1, 1e4 + 1) {
        bool ok = true;
        REP(j, 0, N) {
            if (S[j] == '<') {
                int d = B[j + 1] / i - B[j] / i;
                if (d < 1 || (d == 1 && B[j] % i > B[j + 1] % i)) {
                    ok = false;
                }
            } else {
                int d = B[j] / i - B[j + 1] / i;
                if (d < 1 || (d == 1 && B[j] % i < B[j + 1] % i)) {
                    ok = false;
                }
            }
        }
        if (!ok) break;
        k = i;
    }

    cout << k << endl;
    REP(i, 0, k) {
        REP(j, 0, N + 1) {
            cout << B[j] / k + (i < B[j] % k) << " ";
        }
        cout << endl;
    }
    return 0;
}
