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 Rust (1.15.1) (judge verdict: Accepted)

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        h: usize,
        w: usize,
        mut a: usize,
        mut b: usize
    }
    let mut ans = vec![vec!['.'; w]; h];
    let mut f = false;
    if h * w % 2 == 1 {
        let mut i = 0;
        let mut j = w - 1;
        while i < h - 1 && b > 0 {
            ans[i][j] = '^';
            ans[i + 1][j] = 'v';
            i += 2;
            b -= 1;
        }
        i = h - 1;
        j = 1;
        while j < w && a > 0 {
            ans[i][j] = '<';
            ans[i][j + 1] = '>';
            j += 2;
            a -= 1;
        }
        if a * b % 2 == 1 {
            f = true;
            ans[h - 3][0] = '<';
            ans[h - 3][1] = '>';
            a -= 1;
            ans[h - 2][0] = '^';
            ans[h - 1][0] = 'v';
            b -= 1;
        }
    } else if h % 2 == 1 {
        for j in 0..w / 2 {
            if a == 0 {
                break;
            }
            ans[h - 1][2 * j] = '<';
            ans[h - 1][2 * j + 1] = '>';
            a -= 1;
        }
    } else if w % 2 == 1 {
        for i in 0..h / 2 {
            if b == 0 {
                break;
            }
            ans[2 * i][w - 1] = '^';
            ans[2 * i + 1][w - 1] = 'v';
            b -= 1;
        }
    }
    for i in 0..h / 2 {
        for j in 0..w / 2 {
            if f && 2 * i + 3 == h && j == 0 {
                continue;
            }
            if a >= 2 {
                ans[2 * i][2 * j] = '<';
                ans[2 * i][2 * j + 1] = '>';
                ans[2 * i + 1][2 * j] = '<';
                ans[2 * i + 1][2 * j + 1] = '>';
                a -= 2;
            } else if a == 1 {
                ans[2 * i][2 * j] = '<';
                ans[2 * i][2 * j + 1] = '>';
                a -= 1;
            } else if b >= 2 {
                ans[2 * i][2 * j] = '^';
                ans[2 * i + 1][2 * j] = 'v';
                ans[2 * i][2 * j + 1] = '^';
                ans[2 * i + 1][2 * j + 1] = 'v';
                b -= 2;
            } else if b == 1 {
                ans[2 * i][2 * j] = '^';
                ans[2 * i + 1][2 * j] = 'v';
                b -= 1;
                break;
            }
        }
    }
    if a > 0 || b > 0 {
        println!("NO");
        return;
    }
    println!("YES");
    for l in &ans {
        println!("{}", l.iter().cloned().collect::<String>());
    }
}