CodeEff/ECCO huggingface dataset:
# Original solution
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**8) 
 
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,m = li()
ball = [1]*n
inred = [0]*n
inred[0] = 1

for _ in range(m):
    x,y = li_()
    if inred[x] and ball[x] == 1:
        inred[x] = 0
        ball[x] = 0
        
        inred[y] = 1
        ball[y] += 1
        
    elif inred[x] and ball[x] > 1:
        ball[x] -= 1
        
        inred[y] = 1
        ball[y] += 1
        
    else:
        ball[x] -= 1
        ball[y] += 1
        
ans = 0
for ri in inred:
    ans += ri
print(ans)


# Optimized solution
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x) - 1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n, m = li()
balls = [1]*n
canex = [0]*n

canex[0] = 1

for _ in range(m):
    x, y = li_()
    balls[x] -= 1
    balls[y] += 1

    if balls[x] > 0 and canex[x]:
        canex[y] = 1

    elif balls[x] == 0 and canex[x]:
        canex[y] = 1
        canex[x] = 0

print((sum(canex)))
# Original solution
N,M = list(map(int,input().split()))
R = [0 for _ in range(N+1)]
R[1] = 1
B = [1 for _ in range(N+1)]
B[0] = 0
for _ in range(M):
    x,y = list(map(int,input().split()))
    if R[x]==1:
        R[y] = 1
    B[x] -= 1
    B[y] += 1
    if B[x]==0:
        R[x] = 0
print((sum(R)))

# Optimized solution
N,M = list(map(int,input().split()))
A = [0 for _ in range(N+1)]
B = [1 for _ in range(N+1)]
A[1] = 1
B[0] = 0
for _ in range(M):
    x,y = list(map(int,input().split()))
    if A[x]==1:
        A[y]=1
    B[y] += 1
    B[x] -= 1
    if B[x]==0:
        A[x] = 0
print((sum(A)))
# Original solution
N,M = list(map(int,input().split()))
A = [0 for _ in range(N+1)]
B = [1 for _ in range(N+1)]
A[1] = 1
B[0] = 0
for _ in range(M):
    x,y = list(map(int,input().split()))
    if A[x]==1:
        A[y]=1
    B[y] += 1
    B[x] -= 1
    if B[x]==0:
        A[x] = 0
print((sum(A)))

# Optimized solution
N,M = list(map(int,input().split()))
C = {i:[1,0] for i in range(1,N+1)}
C[1] = [1,1]
for _ in range(M):
    x,y = list(map(int,input().split()))
    C[y][0] += 1
    if C[x][1]==1:
        C[y][1] = 1
    C[x][0] -= 1
    if C[x][0]==0:
        C[x][1]=0
cnt = 0
for i in range(1,N+1):
    if C[i][1]==1:
        cnt += 1
print(cnt)
# Original solution
N,M = list(map(int,input().split()))
C = {i:[1,0] for i in range(1,N+1)}
C[1] = [1,1]
for _ in range(M):
    x,y = list(map(int,input().split()))
    C[y][0] += 1
    if C[x][1]==1:
        C[y][1] = 1
    C[x][0] -= 1
    if C[x][0]==0:
        C[x][1]=0
cnt = 0
for i in range(1,N+1):
    if C[i][1]==1:
        cnt += 1
print(cnt)

# Optimized solution
N,M = list(map(int,input().split()))
C = {i:[1,0] for i in range(1,N+1)}
C[1][1] = 1
for _ in range(M):
    x,y = list(map(int,input().split()))
    C[x][0] -= 1
    C[y][0] += 1
    if C[x][1]==1:
        C[y][1]=1
        if C[x][0]==0:
            C[x][1]=0
cnt = 0
for i in range(1,N+1):
    cnt += C[i][1]
print(cnt)
# Original solution
N, M = list(map(int,input().split()))
z = [list(map(int,input().split())) for i in range(M)]
box = [[1,1]]
for i in range(N-1):
  box.append([0,1])
for i in range(M):
  box[z[i][0]-1][1] -= 1
  box[z[i][1]-1][1] += 1
  if (box[z[i][0]-1][0] == 1):
    box[z[i][1]-1][0] = 1
  if (box[z[i][0]-1][1] == 0):
    box[z[i][0]-1][0] = 0
ans = 0
for i in range(N):
  if (box[i][0] != 0):
    ans += 1
print(ans)

# Optimized solution
N, M = list(map(int, input().split()))
Z = [list(map(int,input().split())) for i in range(M)]
kosuu = [1 for _ in range(N)]
red = [False for _ in range(N)]
red[0] = True

for i in range(M):
  x = Z[i][0] - 1
  y = Z[i][1] - 1
  if (kosuu[x] != 0 and red[x] == True):
    red[y] = True
  if (kosuu[x] == 1 and red[x] == True):
    red[x] = False
  kosuu[x] -= 1
  kosuu[y] += 1

ans = 0
for i in range(N):
  if red[i] == True:
    ans+=1

print(ans)
# Original solution
n,m = list(map(int,input().split()))
lst = [1]*n
red_lst = [0]

for i in range(m):
    x,y = list(map(int,input().split()))
    x -= 1
    y -= 1
    if (x in red_lst) and (y not in red_lst):
        red_lst.append(y)
    if lst[x]==1 and x in red_lst:
        red_lst.remove(x)
    lst[x] -= 1
    lst[y] += 1

cnt = 0
print((len(red_lst)))

# Optimized solution
n,m = list(map(int,input().split()))
lst = [1]*n
red_lst = [False]*n
red_lst[0] = True

xx = []
yy = []
for _ in range(m):
    a,b = list(map(int,input().split()))
    xx.append(a-1)
    yy.append(b-1)

for i in range(m):
    x,y = xx[i], yy[i]
    if red_lst[x]==True and red_lst[y]==False:
        red_lst[y]=True
    if lst[x]==1 and red_lst[x]:
        red_lst[x] = False
    lst[x] -= 1
    lst[y] += 1

print((red_lst.count(True)))
# Original solution
def solve():
    ans = 0
    N, M = list(map(int, input().split()))
    lis = [1]*N
    lis[0] = -1 #赤が入っている可能性があればマイナス
    for _ in range(M):
        x,y = list(map(int, input().split()))
        x -= 1
        y -= 1
        if lis[x]<0:
            lis[y] = -(abs(lis[y])+1)
            lis[x] += 1
        else:
            if lis[y]==0:
                lis[y] = 1
            else:
                lis[y] = (abs(lis[y])+1)*lis[y]//abs(lis[y])
            lis[x] -= 1
    ans = sum([x<0 for x in lis])
    return ans
print((solve()))

# Optimized solution
def solve():
  N, M = list(map(int, input().split()))
  lis = [False]*N
  cnt = [1]*N
  lis[0] = True
  for i in range(M):
    x,y = list(map(int, input().split()))
    x -= 1
    y -= 1
    if lis[x]==True:
      lis[y]=True
      if cnt[x]==1:
        lis[x]=False
    cnt[x] -= 1
    cnt[y] += 1
  ans = lis.count(True)
  return ans
print((solve()))
# Original solution
from collections import defaultdict
n,m=list(map(int, input().split()))
v = [0]*n
v[0]=1
ans = [1]*n
fi = 1
for i in range(m):
    a,b=list(map(int, input().split()))
    ans[a-1]-=1
    ans[b-1]+=1
    if v[a-1]:
        v[b-1]=1
        fi+=1
    if ans[a-1]==0:
        v[a-1]=0
        fi-=1

print((sum(v)))


# Optimized solution
n,m=list(map(int, input().split()))
aka = [0]*(n+1)
siroaka = [1]*(n+1)
aka[1] = 1
for i in range(m):
    x,y=list(map(int, input().split()))
    siroaka[x]-=1
    siroaka[y]+=1
    if(aka[x]):
        aka[y]=1
    if(siroaka[x]==0):
        aka[x]=0

print((sum(aka)))
# Original solution
i=lambda:list(map(int,input().split()));n,m=i();l=[0,1]+[0]*n;c=[0]+[1]*n
for _ in[0]*m:x,y=i();l[y]|=l[x];c[y]+=1;c[x]-=1;l[x]=c[x]and l[x]
print((sum(c[i]and l[i]for i in range(n+1))))

# Optimized solution
i=lambda:list(map(int,input().split()));n,m=i();a=[0]+[1]*n;b=[0,1]+[0]*n
for _ in[0]*m:x,y=i();a[x]-=1;a[y]+=1;b[y]|=b[x];b[x]&=a[x]>0
print((sum(b)))
# Original solution
n,m=list(map(int,input().split()))
a=[1]*(n+1)
b=[0]*(n+1)
b[1]=1
for _ in range(m):
  x,y=list(map(int,input().split()))
  a[x]-=1
  a[y]+=1
  if b[x]:b[y]=1
  if a[x]==0:b[x]=0
ans=0
for i,j in zip(a,b):
  ans+=(i!=0)*j
print(ans)

# Optimized solution
n,m=list(map(int,input().split()))
a=[1]*(n+1)
b=[0]*(n+1)
b[1]=1
for _ in range(m):
  x,y=list(map(int,input().split()))
  a[x]-=1
  a[y]+=1
  if b[x]:b[y]=1
  if a[x]==0:b[x]=0
print((sum(b)))
# Original solution
# coding:utf-8

INF = float('inf')


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


N, M = inpl()
move = [inpl() for _ in range(M)]

ans = [0 for _ in range(N)]
ans[0] = 1
box = [1 for _ in range(N)]
# print(ans, box)
for i in range(M):
    x, y = move[i]
    box[x - 1] -= 1
    box[y - 1] += 1
    if ans[x - 1]:
        ans[y - 1] = 1
        if box[x - 1] == 0:
            ans[x - 1] = 0
    # print(ans, box)


print((sum(ans)))

# Optimized solution
# coding:utf-8

INF = float('inf')


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


N, M = inpl()
# move = [inpl() for _ in range(M)]

ans = [0 for _ in range(N)]
ans[0] = 1
box = [1 for _ in range(N)]
# print(ans, box)
for i in range(M):
    # x, y = move[i]
    x, y = inpl()
    box[x - 1] -= 1
    box[y - 1] += 1
    if ans[x - 1]:
        ans[y - 1] = 1
        if box[x - 1] == 0:
            ans[x - 1] = 0
    # print(ans, box)


print((sum(ans)))
# Original solution
N,M = list(map(int,input().split()))
red_possible = [1] + [0]*(N-1)
balls = [1] * N
for i in range(M):
    x,y = [int(x)-1 for x in input().split()]
    if red_possible[x]:
        red_possible[y] = 1
        if balls[x] == 1:
            red_possible[x] = 0
    balls[x] -= 1
    balls[y] += 1
print((sum(red_possible)))

# Optimized solution
N,M = list(map(int,input().split()))
src = [tuple(map(int,input().split())) for i in range(M)]
red = [0] * N
red[0] = 1
ballnum = [1] * N

for a,b in src:
    a,b = a-1,b-1
    ballnum[b] += 1
    ballnum[a] -= 1
    if red[a]:
        red[b] = 1
        if not ballnum[a]:
            red[a] = 0
print((sum(red)))
# Original solution
N,M = list(map(int,input().split()))
XY = [tuple(map(int,input().split())) for i in range(M)]

rs = [0] * N
rs[0] = 1
cs = [1] * N
for x,y in XY:
    x,y = x-1,y-1
    if rs[x]:
        if cs[x]==1:
            rs[x] = 0
        rs[y] = 1
    cs[x] -= 1
    cs[y] += 1
print((sum(rs)))

# Optimized solution
N,M = list(map(int,input().split()))
XY = [tuple(map(int,input().split())) for i in range(M)]

may_red = [0] * N
may_red[0] = 1
balls = [1] * N

for x,y in XY:
    x,y = x-1,y-1
    if may_red[x]:
        may_red[y] = 1
        if balls[x] == 1:
            may_red[x] = 0
    balls[x] -= 1
    balls[y] += 1
print((sum(may_red)))
# Original solution
N, M = list(map(int, input().split()))
y_if = {1}
num = [1] * N
for i in range(M):
    x, y = list(map(int, input().split()))
    num[x - 1] -= 1
    num[y - 1] += 1
    if x in y_if:
        if num[x - 1] == 0:
            y_if.remove(x)
        y_if.add(y)
print((len(y_if)))


# Optimized solution
N, M = list(map(int, input().split()))
ball = [1] * N
red = {1}
ans = 0
for _ in range(M):
    x, y = list(map(int, input().split()))
    ball[x - 1] -= 1
    ball[y - 1] += 1
    if x in red:
        red.add(y)
        if ball[x - 1] == 0:
            red.remove(x)
print((len(red)))
# Original solution
N, M = list(map(int, input().split()))
boxes = [1] * N
ans = {1}
for i in range(M):
    x, y = list(map(int, input().split()))
    boxes[x - 1] -= 1
    boxes[y - 1] += 1
    if x in ans:
        if boxes[x - 1] == 0:
            ans.remove(x)
        ans.add(y)
print((len(ans)))


# Optimized solution
def int_(num_str):
    return int(num_str) - 1

N, M = list(map(int, input().split()))
balls = [1] * N
red = {0}
for i in range(M):
    x, y = list(map(int_, input().split()))
    if x in red:
        if balls[x] == 1:
            red.remove(x)
            red.add(y)
        else:
            red.add(y)
    balls[x] -= 1
    balls[y] += 1
print((len(red)))
# Original solution
n, m = list(map(int, input().split()))

B = [1] * n
R = [0] * n
R[0] = 1
for _ in range(m):
    x, y = list(map(int, input().split()))
    x -= 1; y -= 1

    if B[x] == 1 and R[x] == 1:
        R[x] =  0; R[y] =  1
    elif B[x] > 1 and R[x] == 1:
        R[y] =  1
    B[x] -= 1; B[y] += 1

print((len([i for i in R if i==1])))

# Optimized solution
n, m = list(map(int, input().split()))

red = [False] * n
ball = [1] * n

red[0] = True
for _ in range(m):
    x, y = [int(x) - 1 for x in input().split()]
    if red[x]:
        red[y] = True
        if ball[x] == 1:
            red[x] = False
    ball[y] += 1
    ball[x] -= 1
print((len(list([x for x in red if x]))))
# Original solution
N,M = list(map(int,input().split()))
L = list(list(map(int,input().split())) for i in range(M))

A = [1 for i in range(N+1)]

red = [0 for i in range(N+1)]
red[1] = 1

ans = 1
for i in range(M) :
    A[L[i][0]] -= 1
    A[L[i][1]] += 1
    if red[L[i][0]] == 1 :
        red[L[i][1]] = 1
    if A[L[i][0]] == 0 :
        red[L[i][0]] = 0
        
ans = sum(red)
print(ans)


# Optimized solution
N,M = list(map(int,input().split()))

L = [1 for i in range(N)]

R = [0 for i in range(N)]
R[0] = 1

for i in range(M) :
    x,y = list(map(int,input().split()))
    x -= 1
    y -= 1
    
    L[x] -= 1
    L[y] += 1
    
    if R[x] == 1 and R[y] == 0 :
        R[y] = 1
    
    if L[x] == 0 and R[x] == 1 :
        R[x] = 0
    

print((sum(R)))
# Original solution
(N, M), *AB = [list(map(int, s.split())) for s in open(0)]
cnt = [1] * N
possibly_red = [False] * N
possibly_red[0] = True
for a, b in AB:
    a -= 1
    b -= 1
    cnt[a] -= 1
    cnt[b] += 1
    if possibly_red[a]:
        possibly_red[b] = True
        if cnt[a] == 0:
            possibly_red[a] = False
print((sum(possibly_red)))


# Optimized solution
N, M, *xy = list(map(int, open(0).read().split()))
boxes = [{"count": 1, "red": False} for _ in range(N)]
boxes[0]["red"] = True

for x, y in zip(*[iter(xy)] * 2):
    x -= 1
    y -= 1
    if boxes[x]["red"]:
        boxes[y]["red"] = True
        if boxes[x]["count"] == 1:
            boxes[x]["red"] = False
    boxes[x]["count"] -= 1
    boxes[y]["count"] += 1
print((sum(b["red"] for b in boxes)))
# Original solution
#!/usr/bin/env python3

N, M = list(map(int, input().split()))
xy_table = []

for _ in range(M):
    x, y = list(map(int, input().split()))
    xy_table.append((x, y))

red_box_list = [1]
# 添字0はダミー
# 添字 = 箱の番号として扱う
n_box_list = [0] + [1] * N

for xy in xy_table:
    x, y = xy
    n_box_list[x] -= 1
    n_box_list[y] += 1
    if x in red_box_list:
        if y not in red_box_list:
            red_box_list.append(y)

        if n_box_list[x] == 0:
            red_box_list.remove(x)

ans = len(red_box_list)

print(ans)


# Optimized solution
#!/usr/bin/env python3

N, M = list(map(int, input().split()))
xy_table = []

for _ in range(M):
    x, y = list(map(int, input().split()))
    xy_table.append((x, y))

red_box_dict = {i: False for i in range(1, N + 1)}
red_box_dict[1] = True
# 添字0はダミー
# 添字 = 箱の番号として扱う
n_box_list = [0] + [1] * N

for xy in xy_table:
    x, y = xy
    n_box_list[x] -= 1
    n_box_list[y] += 1
    if red_box_dict[x]:
        red_box_dict[y] = True

        if n_box_list[x] == 0:
            red_box_dict[x] = False

ans = len([v for v in list(red_box_dict.values()) if v])

print(ans)
# Original solution
N, M = list(map(int, input().split()))

B = [[1, 0] for i in range(N)]

B[0][1] = 1

for i in range(M):
    x, y = list(map(int, input().split()))
    if B[x - 1][1] == 1:
        B[y - 1][1] = 1
    B[x - 1][0] -= 1
    B[y - 1][0] += 1
    if B[x - 1][0] == 0:
        B[x - 1][1] = 0

cnt = 0
for i in range(N):
    if B[i][1] == 1:
        cnt += 1

print(cnt)


# Optimized solution
N, M = list(map(int, input().split()))

B = [1]*N
R=[0]*N

R[0]=1

for i in range(M):
    x, y = list(map(int, input().split()))
    x-=1
    y-=1
    if R[x] == 1:
        R[y] = 1
    B[x] -= 1
    B[y] += 1
    if B[x] == 0:
        R[x] = 0

print((sum(R)))
# Original solution
#!/usr/bin/env python3

def main():
    N, M = list(map(int, input().split()))
    xy = [list(map(int, input().split())) for i in range(M)]
    box = [1] * N
    red_flag = [0] * N
    red_flag[0] = 1
    ans = 0
    for i in range(M):
        if red_flag[xy[i][0] - 1] == 1:
            red_flag[xy[i][1] - 1] = 1
        box[xy[i][0] - 1] -= 1
        if box[xy[i][0] - 1] == 0:
            red_flag[xy[i][0] - 1] = 0
        box[xy[i][1] - 1] += 1
    for i in range(N):
        if box[i] != 0 and red_flag[i] == 1:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()


# Optimized solution
#!/usr/bin/env python3

def main():
    N, M = list(map(int, input().split()))
    xy = [list(map(int, input().split())) for i in range(M)]
    box = [1] * N
    red_flag = [0] * N
    red_flag[0] = 1
    ans = 0
    for i in range(M):
        if red_flag[xy[i][0] - 1] == 1:
            red_flag[xy[i][1] - 1] = 1
        box[xy[i][0] - 1] -= 1
        if box[xy[i][0] - 1] == 0:
            red_flag[xy[i][0] - 1] = 0
        box[xy[i][1] - 1] += 1
    print((sum(red_flag)))


if __name__ == "__main__":
    main()
# Original solution
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N, M = list(map(int, input().split()))
    quantity = [1] * N
    red = [True] + [False] * (N - 1)

    for i in range(M):
        x, y = list(map(int, input().split()))
        quantity[x - 1] -= 1
        quantity[y - 1] += 1
        if red[x - 1] == True:
            red[y - 1] = True

        if quantity[x - 1] == 0:
            red[x - 1] = False
    print((red.count(True)))


resolve()

# Optimized solution
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    N,M=list(map(int,input().split()))
    X, Y = [0] * M, [0] * M
    for i in range(M):
        X[i], Y[i] = list(map(int, input().split()))

    red=[True]+[False]*(N-1)
    cnt=[1]*N

    for i in range(M):
        cnt[X[i]-1]-=1
        cnt[Y[i]-1]+=1
        if red[X[i]-1]:
            red[Y[i]-1]=True
        if cnt[X[i]-1]==0:
            red[X[i] - 1]=False

    print((red.count(True)))


resolve()
# Original solution
n, m = list(map(int, input().split()))
white = [1]*n
white[0] = 0
red = [0] * n
red[0] = 1

for _ in range(m):
    x, y = list(map(int, input().split()))
    x -= 1
    y -= 1

    if red[x] > 0:
        red[y] += 1
    else:
        white[y] += 1

    if white[x] > 0:
        white[x] -= 1
    else:
        red[x] -= 1


ans = n-red.count(0)
print(ans)


# Optimized solution
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N, M = list(map(int, input().split()))
red = [0] * (N + 1)
white = [1] * (N + 1)
red[1] = 1
white[1] = 0

for _ in range(M):
    x, y = list(map(int, input().split()))
    if red[x]:
        red[y] += 1
    else:
        white[y] += 1
    if white[x]:
        white[x] -= 1
    else:
        red[x] -= 1

print((N-red[1:].count(0)))
# Original solution
"""
author : halo2halo
date : 18,Oct,2019
"""

import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

S = readline().rstrip()
ans = 'Yes'
for i in range(len(S)):
    if i % 2 == 0 and S[i] == 'L':
        ans = 'No'
        break
    elif i % 2 == 1 and S[i] == 'R':
        ans = 'No'
        break
print(ans)


# Optimized solution
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

S = readline().decode('utf8').rstrip()
flag1 = True
flag2 = True
Sodd = S[::2]
Seven = S[1::2]

if Sodd.count('L') != 0:
    flag1 = False
if Seven.count('R') != 0:
    flag2 = False

print(('Yes' if flag1 and flag2 else 'No'))
# Original solution
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
ts=time.time()
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
show_flg=False
show_flg=True

an=0
k=0
s=list(input())
n=len(s)
d=[['R','U','D'],['L','U','D']]
for i in range(n):
    if s[i] in d[k]:
        0
    else:
        an=1
    k=1-k
    
print(YN[an])


# Optimized solution
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
ts=time.time()
sys.setrecursionlimit(10**6)
#input=sys.stdin.readline
show_flg=False
show_flg=True

an=0
k=0
s=list(input())
n=len(s)
d=[['R','U','D'],['L','U','D']]
for i in range(n):
    if s[i] in d[k]:
        0
    else:
        an=1
    k=1-k
    
print(YN[an])
# Original solution
def f(s):
	p = True
	for u in s:
		if u not in ('RUD' if p else 'LUD'): return False
		p ^= True 
	return True
print('Yes' if f(input()) else 'No')


# Optimized solution
def f(s):
	p = True
	for u in s:
		if u == ('L' if p else 'R'): return False
		p ^= True 
	return True
print('Yes' if f(input()) else 'No')
# Original solution
import queue, sys
INF = 10**9+7
n = eval(input())
p = []
for i in range(n):
    p.append(int(input()))
dist = [10**7] * n
calc = [-1] * n
used = [False] * n
que = queue.PriorityQueue()
que.put((0, 0))
dist[0] = 0
while not que.empty():
    co, v = que.get()
    if dist[v] < co:
        continue
    for k in range(1, 7):
        go = v+k
        if go>=n:
            break
        if p[go] != 0:
            if calc[go]==-1:
                path = []
                while True:
                    if p[go]==0:
                        break
                    if calc[go]!=-1:
                        go = calc[go]
                        break
                    if used[go]:
                        go = INF
                        break
                    used[go] = True
                    path.append(go)
                    go += p[go]
                for e in path:
                    calc[e] = go
            else:
                go = calc[go]
            if go==INF:
                continue
        if go==n-1:
            print(dist[v]+1)
            exit(0)
        if dist[v] + 1 < dist[go]:
            dist[go] = dist[v] + 1
            que.put((dist[go], go))

# Optimized solution
import queue
INF = 10**9
n = eval(input())
p = [i+int(input()) for i in range(n)]

used = [0] * n
idx = 0
for i in range(n):
    if p[i]!=i:
        path = []
        go = i
        idx += 1
        while go!=INF and p[go]!=go:
            if used[go]==idx:
                go = INF
                break
            used[go] = idx
            path.append(go)
            go = p[go]
        for e in path:
            p[e] = go

dist = [INF] * n
que = queue.Queue()
que.put(0)
dist[0] = 0
while not que.empty():
    v = que.get()
    for k in range(1, min(7, n-v)):
        go = p[v+k]
        if go==n-1:
            print(dist[v]+1)
            exit(0)
        if go!=INF and dist[v] + 1 < dist[go]:
            dist[go] = dist[v] + 1
            que.put(go)
# Original solution
n = int(eval(input()))
k = int(eval(input()))
outcome = 1

for i in range(n):
    outcome = min(outcome*2, outcome+k)

print(outcome)

# Optimized solution
n = int(eval(input()))
k = int(eval(input()))
ans = 1

for _ in range(n):
    ans = min(ans+k,2*ans)

print(ans)
# Original solution
n = int(eval(input()))
k = int(eval(input()))
cur = 1
for i in range(n):
    if (cur * 2) > (cur + k):
        cur += k
    else:
        cur *= 2
print(cur)

# Optimized solution
n = int(eval(input()))
k = int(eval(input()))
res = 1
for i in range(n):
    if res > k:
        res += k
    else:
        res *= 2
print(res)