Problem:
Score : 100 points

Problem Statement

You are given a grid of N rows and M columns. The square at the i-th row and j-th column will be denoted as (i,j).
Some of the squares contain an object. All the remaining squares are empty.
The state of the grid is represented by strings S_1,S_2,\cdots,S_N. The square (i,j) contains an object if S_{i,j}= # and is empty if S_{i,j}= ..

Consider placing 1 \times 2 tiles on the grid. Tiles can be placed vertically or horizontally to cover two adjacent empty squares.
Tiles must not stick out of the grid, and no two different tiles may intersect. Tiles cannot occupy the square with an object.

Calculate the maximum number of tiles that can be placed and any configulation that acheives the maximum.

Constraints

1 \leq N \leq 100

1 \leq M \leq 100

S_i is a string with length M consists of # and ..

Input

Input is given from Standard Input in the following format:

N M
S_1
S_2
\vdots
S_N

Output

On the first line, print the maximum number of tiles that can be placed.

On the next N lines, print a configulation that achieves the maximum.
Precisely, output the strings t_1,t_2,\cdots,t_N constructed by the following way.

t_i is initialized to S_i.

For each (i,j), if there is a tile that occupies (i,j) and (i+1,j), change t_{i,j}:=v, t_{i+1,j}:=^.

For each (i,j), if there is a tile that occupies (i,j) and (i,j+1), change t_{i,j}:=>, t_{i,j+1}:=<.

See samples for further information.

You may print any configulation that maximizes the number of tiles.

Sample Input 1

3 3
#..
..#
...

Sample Output 1

3
#><
vv#
^^.

The following output is also treated as a correct answer.

3
#><
v.#
^><

Solution in C++ (GCC 9.2.1 with AC Library v1.1) (judge verdict: Wrong Answer)

#include <atcoder/all>
using namespace atcoder;
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr lint B1 = 1532834020;
constexpr lint M1 = 2147482409;
constexpr lint B2 = 1388622299;
constexpr lint M2 = 2147478017;
constexpr int INF = 2147483647;
void yes(bool expr) {cout << (expr ? "Yes" : "No") << "\n";}
template<class T>void chmax(T &a, const T &b) { if (a<b) a=b; }
template<class T>void chmin(T &a, const T &b) { if (b<a) a=b; }
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int N, M;
  cin >> N >> M;
  vector<string> S(N);
  REP(i, N) cin >> S[i];
  mf_graph<int> graph(N*M+2);
  REP(i, N) REP(j, M) {
    if(S[i][j] == '#') continue;
    if((i+j)%2 == 0) {
      graph.add_edge(N*M, i*M+j, 1);
      if(i != 0 && S[i-1][j] == '.') graph.add_edge(i*M+j, (i-1)*M+j, 1);
      if(i != N-1 && S[i+1][j] == '.') graph.add_edge(i*M+j, (i+1)*M+j, 1);
      if(j != 0 && S[i][j-1] == '.') graph.add_edge(i*M+j, i*M+j-1, 1);
      if(j != M-1 && S[i][j+1] == '.') graph.add_edge(i*M+j, i*M+j+1, 1);
    } else graph.add_edge(i*M+j, N*M+1, 1);
  }
  cout << graph.flow(N*M, N*M+1) << "\n";
  vector<mf_graph<int>::edge> edges = graph.edges();
  REP(i, edges.size()) {
    if(edges[i].flow == 0 || edges[i].from == N*M || edges[i].to == N*M+1) continue;
    int mi = min(edges[i].from, edges[i].to);
    int ma = max(edges[i].from, edges[i].to);
    if(ma - mi == 1) {
      S[mi/M][mi%M] = '>';
      S[ma/M][ma%M] = '<';
    } else {
      S[mi/M][mi%M] = 'v';
      S[ma/M][ma%M] = '^';
    }
  }
  REP(i, N) cout << S[i] << "\n";
}