human
Bashar was practicing for the national programming contest. Because of sitting too much in front of the computer without doing physical movements and eating a lot Bashar became much fatter. Bashar is going to quit programming after the national contest and he is going to become an actor (just like his father), so he should lose weight.

In order to lose weight, Bashar is going to run for k kilometers. Bashar is going to run in a place that looks like a grid of n rows and m columns. In this grid there are two one-way roads of one-kilometer length between each pair of adjacent by side cells, one road is going from the first cell to the second one, and the other road is going from the second cell to the first one. So, there are exactly (4 n m - 2n - 2m) roads.

Let's take, for example, n = 3 and m = 4. In this case, there are 34 roads. It is the picture of this case (arrows describe roads):


Bashar wants to run by these rules:

  * He starts at the top-left cell in the grid.

  * In one move Bashar may go up (the symbol 'U'), down (the symbol 'D'), left (the symbol 'L') or right (the symbol 'R'). More formally, if he stands in the cell in the row i and in the column j, i.e. in the cell (i, j) he will move to: 
    * in the case 'U' to the cell (i-1, j).

    * in the case 'D' to the cell (i+1, j).

    * in the case 'L' to the cell (i, j-1).

    * in the case 'R' to the cell (i, j+1).

  * He wants to run exactly k kilometers, so he wants to make exactly k moves.

  * Bashar can finish in any cell of the grid.

  * He can't go out of the grid so at any moment of the time he should be on some cell.

  * Bashar doesn't want to get bored while running so he must not visit the same road twice. But he can visit the same cell any number of times. 


Bashar asks you if it is possible to run by such rules. If it is possible, you should tell him how should he run.

You should give him a steps to do and since Bashar can't remember too many steps, a should not exceed 3000. In every step, you should give him an...
Using python3 can you solve the prior task?
assistant
#Here is the Python code you requested.

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())

def read_int_n():
    return list(map(int, input().split()))

def read_float():
    return float(input())

def read_float_n():
    return list(map(float, input().split()))

def read_str():
    return input().strip()

def read_str_n():
    return list(map(str, input().split()))

def error_print(*args):
    print(*args, file=sys.stderr)

def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap

@mt
def slv(N, M, K):
    step = []

    if M >= N:
        RUD = 'RUD'
        R = 'R'
        L = 'L'
        D = 'D'
        U = 'U'
    else:
        RUD = 'DLR'
        R = 'D'
        L = 'U'
        D = 'R'
        U = 'L'
        N, M = M, N
    for i in range(N):
        if i != 0:
            step.append((M-1, RUD))
        else:
            step.append((M-1, R))
        step.append((M-1, L))
        if i != N -1:
            step.append((1, D))
    if N > 1:
        step.append((N-1, U))

    # error_print(step)

    ans = []
    for s in step:
        if K >= s[0] * len(s[1]):
            ans.append(s)
            K -= s[0] * len(s[1])
        elif K > 0:
            if K > len(s[1]):
                r = K // len(s[1])
                ans.append((r, s[1]))
                K -= r * len(s[1])
            if K != 0:
                ans.append((1, s[1][:K]))
                K = 0

    if K == 0:
        print('YES')
        print(len(ans))
        for n, s in ans:
            print('%d...