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 <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

int A,B,N,M;
string res[1001];

void putA(ll i,ll j){
  res[i][j]='<'; res[i][j+1]='>'; A--;
}
void putB(ll i,ll j){
  res[i][j]='^'; res[i+1][j]='v'; B--;
}


int main(){
  cin>>N>>M>>A>>B;
  int area=N*M,tot=2*(A+B);
  if(area<tot){
    cout<<"NO"<<endl;
    return 0;
  }
  rep(i,N)rep(j,M)res[i]+=".";
  if(N%2==0&&M%2==0){
    for(ll i=0;i<N;i+=2)for(ll j=0;j<M;j+=2){
      if(A>0){
        putA(i,j);
        if(A>0)putA(i+1,j);
      }else if(B>0){
        putB(i,j);
        if(B>0)putB(i,j+1);
      }
    }
  }else if(M%2==0){
    for(ll j=0;j<M;j+=2){
      if(A>0){
        putA(N-1,j);
      }
    }
    for(ll i=0;i<N-1;i+=2)for(ll j=0;j<M;j+=2){
      if(A>0){
        putA(i,j);
        if(A>0)putA(i+1,j);
      }else if(B>0){
        putB(i,j);
        if(B>0)putB(i,j+1);
      }
    }
  }else if(N%2==0){
    for(ll i=0;i<N;i+=2){
      if(B>0){
        putB(i,M-1);
      }
    }
    for(ll i=0;i<N;i+=2)for(ll j=0;j<M-1;j+=2){
      if(A>0){
        putA(i,j);
        if(A>0)putA(i+1,j);
      }else if(B>0){
        putB(i,j);
        if(B>0)putB(i,j+1);
      }
    }
  }else{
    ll preA=A,preB=B;
    for(ll j=0;j<M-1;j+=2){
      if(A>0){
        putA(N-1,j);
      }
    }
    for(ll i=0;i<N-1;i+=2){
      if(B>0){
        putB(i,M-1);
      }
    }
    for(ll i=0;i<N-1;i+=2)for(ll j=0;j<M-1;j+=2){
      if(A>0){
        putA(i,j);
        if(A>0)putA(i+1,j);
      }else if(B>0){
        putB(i,j);
        if(B>0)putB(i,j+1);
      }
    }

    if(A>0||B>0){
      rep(i,N)res[i]="";
      rep(i,N)rep(j,M)res[i]+=".";
      
      A=preA; B=preB;
      assert(A>=2&&B>=2);
      putA(N-3,M-3); putB(N-3,M-1);
      putA(N-1,M-2); putB(N-2,M-3);
      for(ll j=0;j<M-3;j+=2){
        if(A>0){
          putA(N-1,j);
        }
      }
      for(ll i=0;i<N-3;i+=2){
        if(B>0){
          putB(i,M-1);
        }
      }
      for(ll i=0;i<N-1;i+=2)for(ll j=0;j<M-1;j+=2){
        if(i==N-3&&j==M-3)continue;

        if(A>0){
          putA(i,j);
          if(A>0)putA(i+1,j);
        }else if(B>0){
          putB(i,j);
          if(B>0)putB(i,j+1);
        }
      }
    }
  }
  if(A>0||B>0){
    cout<<"NO"<<endl;
    return 0;
  }
  cout<<"YES"<<endl;
  rep(i,N){
    cout<<res[i]<<endl;
  }
  return 0;
}