#include<ctime>
#include<cstdio>
#include<cctype>
using namespace std;
const int N=1e2+7;
int read() {
	char c;
	int x=0,f=1;
	while(!isdigit(c=getchar()))
		f-=2*(c=='-');
	while (isdigit(c)){
		x=x*10+(c-48)*f;
		c=getchar();
	}
	return x;
}
char s[N];
int n,m,a[N];
int chk(int x){
	for(int i=1;i<=n;++i){
		if(s[i-1]=='<'){
			if(a[i-1]%x>a[i]%x){
				if(a[i-1]/x+1>=a[i]/x)
					return 0;
			}
			else{
				if(a[i-1]/x>=a[i]/x)
					return 0;
			}
		}
		else{
			if(a[i-1]%x<a[i]%x){
				if(a[i-1]/x<=a[i]/x+1)
					return 0;
			}
			else{
				if(a[i-1]/x<=a[i]/x)
					return 0;
			}
		}
	}
	return 1;
}
void solve(){
	int l=1,r=1e4,ans=0;
	while(l<=r){
		int mid=(l+r)>>1;
		if(chk(mid)){
			l=mid+1;
			ans=mid;
		}
		else
			r=mid-1;
	}
	printf("%d\n",ans);
	for(int i=1;i<=ans;++i){
		for(int j=0;j<=n;++j)
			printf("%d ",a[j]/ans+(a[j]%ans>=i));
		puts("");
	}
}
int main() {
	#ifndef ONLINE_JUDGE
	freopen("A.in","r",stdin);
	freopen("A.out","w",stdout);
	#endif
	clock_t t1=clock();
	//--------
	n=read();
	scanf("%s",s);
	for(int i=0;i<=n;++i)
		a[i]=read();
	solve();
	//--------
	clock_t t2=clock();
	fprintf(stderr,"time:%0.3lfs",1.0*(t2-t1)/CLOCKS_PER_SEC);
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
double a[101][101][101];
int main()
{
	for(int i=99;i>=0;--i)
	{
		for(int j=99;j>=0;--j)
		{
			for(int k=99;k>=0;--k)
			{
				a[i][j][k]=i*1.0/(i+j+k)*(1+a[i+1][j][k])+j*1.0/(i+j+k)*(1+a[i][j+1][k])+k*1.0/(i+j+k)*(1+a[i][j][k+1]);
			}
		}
	}
	int i,j,k;
	scanf("%d%d%d",&i,&j,&k);
	printf("%f",a[i][j][k]);
	return 0;
}