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

int calc_min_delta(const vector<int> &a){
    int ret = 1e9;
    for(int i=1; i<int(a.size()); ++i){
        ret = min(ret, abs(a[i] - a[i-1]));
    }
    return ret;
}

int main(){
    int n;
    string s;
    cin >> n >> s;
    vector<int> a(n+1);
    for(int i=0; i<=n; ++i)cin >> a[i];
    const auto k = calc_min_delta(a);
    cout << k << endl;
    for(int i=0; i<k; ++i){
        cout << (a[0] + i) / k;
        for(int j=1; j<=n; ++j){
            cout << " " << (a[j] + i) / k;
        }
        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;

int n;
char s[110];
int a[110];
int b[110];
int maxB[110];
int szA;
int step[110];
int r[110];

bool checkYes(int numA, int numB, char sign) {
	if (numA == numB)
		return false;
		
	if (sign == '>') {
		if (numA > numB)
			return true;
		else
			return false;
	} else {	//<
		if (numA < numB)
			return true;
		else
			return false;
	}
}

void testB() {
	int curLevel = 0;
	b[0] = 0;
	int minD = b[0];
	for (int i = 0 ; i < n ; i++) {
		if (s[i] == '<') {
			b[i + 1] = b[i] + 1;
		} else {
			b[i + 1] = b[i] - 1;
		}
		
		if (minD > b[i + 1])
			minD = b[i + 1];
	}
	
	int adds = -minD;
	for (int i = 0 ; i <= n ; i++) {
		b[i] = b[i] + adds;
	}
	
	for (int i = 0 ; i <= n ; i++) {
		maxB[i] = b[i];
	}	
	
	if (s[0] == '<') {
		b[0] = 0;
	}
	if (s[n - 1] == '>') {
		b[n] = 0;
	}
	for (int i = 1 ; i < n ; i++) {
		if ((s[i - 1] == '>') && (s[i] == '<')) {
			b[i] = 0;
		}
	}
	
	for (int ii = 0 ; ii <= 200 ; ii++) {
		for (int i = 0 ; i <= n ; i++) {
			int curNum = b[i] - 1;
			if (curNum < 0)
				continue;
			bool canDel = true;
			if ((i - 1) >= 0) {
				if (checkYes(b[i - 1], curNum, s[i - 1]) == false) {
					canDel = false;
				}
			}
			
			if (i + 1 <= n) {
				if (checkYes(curNum, b[i + 1], s[i]) == false) {
					canDel = false;
				}				
			}
			
			if (canDel) {
				b[i] = curNum;
			}
		}
	}
}

bool checkLast(int b[]) {
	for (int i = 0 ; i < n ; i++) {
		int numA = a[i] - b[i];
		int numB = a[i + 1] - b[i + 1];
		if ((numA < 0) || (numB < 0))
			return false;
		
		if ((a[i] - b[i]) == (a[i + 1] - b[i + 1])) 
			return false;
			
		bool isBigger = true;
		if ((a[i] - b[i]) > (a[i + 1] - b[i + 1])) {
			isBigger = true;
		} else {
			isBigger = false;
		}
		
		if (s[i] == '>') {
			if (isBigger == false) {
				return false;
			}
		} else {	//<
			if (isBigger == true) {
				return false;
			}			
		}
	}
	
	return true;
}

int main(void)
{
	scanf("%d\n", &n);
	scanf("%s\n", s);
	szA = n + 1;
	for (int i = 0 ; i <= n ; i++) {
		scanf("%d", &(a[i]));
	}
	testB();
	
	int minDiff = abs(a[1] - a[0]);
	for (int i = 2 ; i <= n ; i++) {
		int curDiff = abs(a[i] - a[i - 1]);
		if (minDiff > curDiff)
			minDiff = curDiff;
	}
	
	int k = minDiff;
	printf("%d\n", k);
	
	for (int j = 0 ; j <= n ; j++) {
		a[j] = a[j] - b[j] * k;
		step[j] = a[j] / k;
		r[j] = a[j] % k;
	}
	
	for (int i = 0 ; i < k ; i++) {
		for (int j = 0 ; j <= n ; j++) {
			int curNum;
			if (r[j] > 0) {
				curNum = b[j] + step[j] + 1;
				r[j]--;
			} else {
				curNum = b[j] + step[j];
			}
			printf("%d ", curNum);
		}
		printf("\n");
	}
	
	return 0;
}