Problem:
Score : 900 points

Problem Statement

Takahashi has an N \times M grid, with N horizontal rows and M vertical columns.
Determine if we can place A 1 \times 2 tiles (1 vertical, 2 horizontal) and B 2 \times 1 tiles (2 vertical, 1 horizontal) satisfying the following conditions, and construct one arrangement of the tiles if it is possible:

All the tiles must be placed on the grid.

Tiles must not stick out of the grid, and no two different tiles may intersect.

Neither the grid nor the tiles may be rotated.

Every tile completely covers exactly two squares.

Constraints

1 \leq N,M \leq 1000

0 \leq A,B \leq 500000

N, M, A and B are integers.

Input

Input is given from Standard Input in the following format:

N M A B

Output

If it is impossible to place all the tiles, print NO.
Otherwise, print the following:

YES
c_{11}...c_{1M}
:
c_{N1}...c_{NM}

Here, c_{ij} must be one of the following characters: ., <, >, ^ and v. Represent an arrangement by using each of these characters as follows:

When c_{ij} is ., it indicates that the square at the i-th row and j-th column is empty;

When c_{ij} is <, it indicates that the square at the i-th row and j-th column is covered by the left half of a 1 \times 2 tile;

When c_{ij} is >, it indicates that the square at the i-th row and j-th column is covered by the right half of a 1 \times 2 tile;

When c_{ij} is ^, it indicates that the square at the i-th row and j-th column is covered by the top half of a 2 \times 1 tile;

When c_{ij} is v, it indicates that the square at the i-th row and j-th column is covered by the bottom half of a 2 \times 1 tile.

Sample Input 1

3 4 4 2

Sample Output 1

YES
<><>
^<>^
v<>v

This is one example of a way to place four 1 \times 2 tiles and three 2 \times 1 tiles on a 3 \times 4 grid.

Sample Input 2

4 5 5 3

Sample Output 2

YES
<>..^
^.<>v
v<>.^
<><>v

Sample Input 3

7 9 20 20

Sample Output 3

NO

Solution in C++14 (GCC 5.4.1) (judge verdict: Runtime Error)

#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
typedef unsigned long long ull;
const int inf=103974182;
using namespace std;
char map[1005][1005];

int main()
{
	rep(1005)
	{
		repj(1005)
		{
			map[i][j]='.';
		}
	}
//	freopen("input.txt","r",stdin);
	ll n,m,a,b;
	cin>>n>>m>>a>>b;
	ll nn=n,mm=m,aa=a,bb=b;
	if((n&1) && (m&1))
	{
		ll tn=n,tm=m;
		a=max(0LL,a-m/2);
		b=max(0LL,b-n/2);
		n--;
		m--;
		if(n*m/2<(a+b)) over("NO");
		if(n*m/2==(a+b) && (a&1) && (b&1)) over("NO");
	}
	else if((n&1))
	{
		ll tn=n,tm=m;
		a=max(0LL,a-m/2);
		n--;
		if(n*m/2<(a+b)) over("NO");
		if(n*m/2==(a+b) && (a&1) && (b&1)) over("NO");
	}
	else if((m&1))
	{
		ll tn=n,tm=m;
		b=max(0LL,b-n/2);
		m--;
		if(n*m/2<(a+b)) over("NO");
		if(n*m/2==(a+b) && (a&1) && (b&1)) over("NO");
	}
	else
	{
		if(n*m/2<(a+b)) over("NO");
		if(n*m/2==(a+b) && (a&1) && (b&1)) over("NO");
	}
	n=nn;
	m=mm;
	a=aa;
	b=bb;
	if((n&1) && (m&1))
	{
		a-=2;
		b-=2;
		map[n-1][m-1]='>';
		map[n-3][m-3]='<';
		map[n-2][m-2]='.';
		map[n-1][m-2]='<';
		map[n-1][m-3]='v';
		map[n-2][m-3]='^';
		map[n-2][m-1]='v';
		map[n-3][m-2]='>';
		map[n-3][m-1]='^';
	}
	if(n&1)
	{
		for(int i=0;i<m-1;i+=2)
		{
			if(map[n-1][i]!='.') continue;
			if(map[n-1][i+1]!='.') continue;
			map[n-1][i]='<';
			map[n-1][i+1]='>';
			a--;
			if(a==0) break;
		}
	}
	if(m&1)
	{
		for(int i=0;i<n-1;i+=2)
		{
			if(map[i][m-1]!='.') continue;
			if(map[i+1][m-1]!='.') continue;
			map[i][m-1]='^';
			map[i+1][m-1]='v';
			b--;
			if(b==0) break;
		}
	}
//	cout<<a<<' '<<b<<endl;
	for(int i=0;i<n-n%2;i++)
	{
		for(int j=m-m%2-1;j>=0;j--)
		{
//			if(i==2 && j==0) cout<<b<<endl;
			if(map[i][j]!='.') continue;
//			if(i==2 && j==0) cout<<b<<endl;
			if(map[i+1][j]!='.') continue;
//			if(i==2 && j==0) cout<<b<<endl;
			if(i+1>=n) continue;
//			if(i==2 && j==0) cout<<b<<endl;
//			if(a)
//			{
//				map[i][j]='<';
//				map[i][j+1]='>';
//				a--;
//			}
			if(b)
			{
				map[i][j]='^';
				map[i+1][j]='v';
				b--;
			}
			else
			{
				break;
			}
		}
	}
//	cout<<map[2][0]<<' '<<map[3][0]<<endl;
	for(int i=0;i<n-n%2;i++)
	{
		for(int j=0;j<m-m%2;j++)
		{
			if(map[i][j]!='.') continue;
			if(map[i][j+1]!='.') continue;
			if(j+1>=m) continue;
			if(a)
			{
				map[i][j]='<';
				map[i][j+1]='>';
				a--;
			}
//			if(b)
//			{
//				map[i][j]='^';
//				map[i+1][j]='v';
//				b--;
//			}
			else
			{
				break;
			}
		}
	}
	if(a || b) over("NO\n");
	cout<<"YES\n";
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			putchar(map[i][j]);
		}
		printf("\n");
	}
	return 0;
}