Harryxun/stf_run huggingface dataset:
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 10 ** 9 + 7

def mapline(t = int):
    return map(t, sysread().split())
def mapread(t = int):
    return map(t, read().split())

def run():
    N, *A = mapread()
    ans = 1
    current = [0,0,0]
    for a in A:
        transition = 0
        #cache = 1
        for i, c in enumerate(current):
            if c == a:
                transition += 1
                cache = i
        ans *= transition
        ans %= mod
        current[cache] += 1
        #print(current)
    print(ans)

if __name__ == "__main__":
    run()


### FIXED CODE ###

# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 10 ** 9 + 7

def mapline(t = int):
    return map(t, sysread().split())
def mapread(t = int):
    return map(t, read().split())

def run():
    N, *A = mapread()

    dp = [defaultdict(lambda:0) for _ in range(N+1)]
    dp[0][(0,0,0)] = 1
    for i in range(N):
        a = A[i]
        k = i + 1
        for key in dp[k-1].keys():
            for ii, v in enumerate(key):
                if v == a:
                    tmp = list(key)
                    tmp[ii] += 1
                    dp[k][tuple(tmp)] += dp[k-1][key] % mod
    ans = 0
    for key in dp[N].keys():
        ans = (ans + dp[N][key]) % mod
    #print(dp)
    print(ans)


if __name__ == "__main__":
    run()
N=int(input())
A=list(map(int,input().split()))
I=2*N
D=[[-INF]*(N+1)for _ in range(N+1)]
M=0
r=[-INF]*(N+1)
def c(i,j,k):
    DP[i][j]=max(k,D[i][j])
    DP[j][i]=max(k,D[j][i])
    r[i]=max(r[i],D[i][j])
    r[j]=max(r[j],D[i][j])
    global M
    M=max(M,k)
a=0
D[A[0]][A[1]]=0
D[A[1]][A[0]]=0
r[A[0]]=0
r[A[1]]=0
for i in range(N-1):
    n=A[3*i+2:3*i+5]
    C=[]
    if len(set(n))==1:
        a+=1
        continue
    if len(set(n))==2:
        for j in range(3):
            if n.count(n[j])==2:
                X=n[j]
            else:
                Y=n[j]
        for j in range(1,N+1):
            C.append((j,Y,D[X][j]+1))
    X,Y,Z =n
    C.append((X,Y,D[Z][Z]+1))
    C.append((Y,Z,D[X][X]+1))
    C.append((X,Z,D[Y][Y]+1))
    C.append((X,Y,M))
    C.append((X,Z,M))
    C.append((Y,Z,M))
    for j in range(1,N+1):
        for k in range(3):
            C.append((j,n[k],r[j]))
    for j,k,l in change:
        c(j,k,l)
M=max(M,D[A[-1]][A[-1]]+1)
print(a+M)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
INF = 2*N
DP = [[-INF]*(N+1) for _ in range(N+1)]
M = 0
rowM = [-INF]*(N+1)

def chmax(i,j,k):
    DP[i][j] = max(k,DP[i][j])
    DP[j][i] = max(k,DP[j][i])
    rowM[i] = max(rowM[i],DP[i][j])
    rowM[j] = max(rowM[j],DP[i][j])
    global M
    M = max(M,k)

ans = 0
DP[A[0]][A[1]] = 0
DP[A[1]][A[0]] = 0
rowM[A[0]] = 0
rowM[A[1]] = 0
for i in range(N-1):
    new = A[3*i+2:3*i+5]
    change = []
    if len(set(new)) == 1:
        ans += 1
        continue
    if len(set(new)) == 2:
        for j in range(3):
            if new.count(new[j]) == 2:
                X = new[j]
            else:
                Y = new[j]
        for j in range(1,N+1):
            change.append((j,Y,DP[X][j]+1))
    X,Y,Z = new
    change.append((X,Y,DP[Z][Z]+1))
    change.append((Y,Z,DP[X][X]+1))
    change.append((X,Z,DP[Y][Y]+1))
    change.append((X,Y,M))
    change.append((X,Z,M))
    change.append((Y,Z,M))
    for j in range(1,N+1):
        for k in range(3):
            change.append((j,new[k],rowM[j]))
    for j,k,l in change:
        chmax(j,k,l)
M = max(M,DP[A[-1]][A[-1]]+1)
print(ans+M)
N, X = map(int, input().split())
L = list(map(int, input().split()))

D = 0

for i in range(N):
  D = D + L[i]
  if D > X:
    ans = i+1
    break
print(ans)

### FIXED CODE ###

N, X = map(int, input().split())
L = list(map(int, input().split()))

D = 0
ans = 1
for i in range(N):
  D = D + L[i]
  if D <= X:
    ans += 1
print(ans)
W, H, x, y = map(int, input().split())
jufuku = 0
if (x == 0 and y == 0) or y / x == H / W:
    naname = W * H / 2
    jufuku = 1
    kiri = naname
else:
    # 縦
    tate = min((W - x) * H, x * H)
    # 横
    yoko = min(W * (H - y), W * y)
    if tate == yoko:
        jufuku = 1
    kiri = max(tate, yoko)
print(kiri, jufuku)


### FIXED CODE ###

W, H, x, y = map(int, input().split())
jufuku = 0
if W / 2 == x and H / 2 == y:
    jufuku = 1
print(W * H / 2, jufuku)
N = int(input())
A = [1]
for i in range(1,7):
    A.append(6 ** i)
for i in range(1, 6):
    A.append(9 ** i)


A = sorted(A)
dp = [float("inf")] * (N+1)
dp[0] = 0

for i in range(1,N+1):
    for k, v in enumerate(A):
        if i >= v:
            dp[i] = min(dp[i], dp[i-A[s]]+1)
            
            
print(dp[N])

### FIXED CODE ###

N = int(input())
A = []

A.append(1)
for i in range(1,7):
    A.append(6**i)
for i in range(1,6):
    A.append(9**i)
    
    
A.sort()
dp = [10*5+5]*(N+1)
dp[0] = 0
for i in range(1, N+1):
    for s in range(len(A)):
        if i-A[s] >= 0:
            dp[i] = min(dp[i-A[s]]+1, dp[i])
            
            
print(dp[N])
n = int(input())
a = list(map(int, input().split()))
# a = sorted(a)
a.sort()
if a[0] == 1:
    if a[1] == 1:
        print(0)
        exit()
    else:
        print(1)
        exit()
check = True
ans = 0
double = []
for i in range(n):
    if not i == 0:
        if a[i-1] == a[i]:
            double.append(a[i])
    for j in range(0, i):
        if not a[j] == 1:
            if a[j]*2 > a[i]:
                break
        if i == j:
            continue
        if a[i]%a[j] == 0:
            check = False
            break

    if check:
        ans += 1
        # print(i)
    check = True
# print(a)
# print(ans)
# print(double)
for i in set(double):
    ans -= a.count(i)
# ans -= len(set(double))
# ans -= len(double)
print(ans)

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort()
c = Counter(a)
m = max(a) + 1
dp = [False]*m
ans = 0
for ai in a:
    if dp[ai]:
        continue
    if c[ai] == 1:
        ans += 1
    for i in range(ai, m, ai):
        dp[i] = True
print(ans)
n,k=map(int,input().split())
mo=10**9+7
f=[0]*(1+n)
r=[0]*(1+n)

def fact(n):
    if n==0:
        f[0]=1
        return 1
    if f[n]!=0:
        return f[n]
    f[n]=n*fact(n-1)%mo
    return f[n]

r[n]=pow(fact(n),mo-2,mo)

def revfact(n):
    if r[n]!=0:
        return r[n]
    r[n]=( (n+1)*revfact(n+1) )%mo
    return r[n]
    
def comb(n,k):
    return fact(n)*revfact(n-k)*revfact(k)%mo

fact(n)
revfact(0)

for i in range(1,1+k):
    print(comb(n-k+1,i)*comb(k-1,i-1)%mo)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
n,k=map(int,input().split())
mo=10**9+7
f=[0]*(1+n)
r=[0]*(1+n)

def fact(n):
    if n==0:
        f[0]=1
        return 1
    if f[n]!=0:
        return f[n]
    f[n]=n*fact(n-1)%mo
    return f[n]

r[n]=pow(fact(n),mo-2,mo)

def revfact(n):
    if r[n]!=0:
        return r[n]
    r[n]=( (n+1)*revfact(n+1) )%mo
    return r[n]
    
def comb(n,k):
    return fact(n)*revfact(n-k)*revfact(k)%mo

fact(n)
revfact(0)

for i in range(1,1+k):
    print((comb(n-k+1,i)*comb(k-1,i-1))%mo if n-k>=i-1 else 0)
#
import sys
from math import *
import numpy as np
import itertools

n = int(input())
a=[]
b=[]
c=[]
d=[]
for j in range(0,n):
    t1,t2,t3,t4 = (int(i) for i in input().split())  
    a.append(t1)
    b.append(t2)
    c.append(t3)
    d.append(t4)
    
for i in range(0,n):
    if a[i] < b[i]:
        print("No")
    elif d[i] < b[i]:
        print("No")
    else:
        flag=1
        p= gcd(b[i],d[i])
        if (b[i]-p)+a[i]%p > c[i]:
            print("No")
        else:
            print("Yes")
    



### FIXED CODE ###

#
import sys

n = int(input())
a=[]
b=[]
c=[]
d=[]
for j in range(0,n):
    t1,t2,t3,t4 = (int(i) for i in input().split())  
    a.append(t1)
    b.append(t2)
    c.append(t3)
    d.append(t4)
    
for i in range(0,n):
    if a[i] < b[i]:
        print("No")
    elif d[i] < b[i]:
        print("No")
    else:
        p= b[i]
        q= d[i]
        while p%q :
            r=q
            q=p%q
            p=r
        if (b[i]-q)+a[i]%q > c[i]:
            print("No")
        else:
            print("Yes")
N, M = map(int, input().split())
NG = []
a = 10**9+7
for i in range(M):
  NG.append(int(input()))
ans = [0 for _ in range(N + 2)]
ans[0] = 1
for i in range(N):
  if not i + 1 in NG:
    ans[i + 1] = (ans[i + 1] + ans[i])%a
  if not i + 2 in NG:
    ans[i + 2] = (ans[i + 2] + ans[i])%a
print(ans[N])

### FIXED CODE ###

P, Q, R = map(int, input().split())
print(P+Q+R-max(P,Q,R))
# 与えられた整数の約数を返す
def func_divisors(x):
  divisors = []
  for i in range(1,int(x**0.5)+1):
    if x % i == 0:
      divisors.append(i)
      if i != x / i:
        divisors.append(int(x/i))
        
  divisors.sort()
  return divisors
  
A_divisors = func_divisors(A)
B_divisors = func_divisors(B)
C_divisors = list(set(A_divisors) & set(B_divisors))

print(C_divisors[K-1])
  

### FIXED CODE ###

A,B,K = map(int,input().split(' '))
# 与えられた整数の約数を返す
def func_divisors(x):
  divisors = []
  for i in range(1,int(x**0.5)+1):
    if x % i == 0:
      divisors.append(i)
      if i != x / i:
        divisors.append(int(x/i))
        
  divisors.sort()
  return divisors
  
A_divisors = func_divisors(A)
B_divisors = func_divisors(B)
C_divisors = sorted(list(set(A_divisors) & set(B_divisors)),reverse=True)

print(C_divisors[K-1])
a,b,k=map(int,input().split())
print([i for i in range(min([a,b])) if i%a==0 and i%b==0][-k])

### FIXED CODE ###

a,b,k=map(int,input().split())
print([i for i in range(1,min([a,b])+1) if a%i==0 and b%i==0][-k])
a, b = int(input().split())

if ((a + b) % 2) == 0:
    print((a + b) / 2)
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

a,b = map(int, input().split())

if(a < b):
  swap = b
  b = a
  a = swap

k = (a + b) // 2

if ((((a + b) % 2) == 0) and (a >= k) and (k >= b)) :
    print(k)
else:
    print("IMPOSSIBLE")
N = int(inout())
L = int(input().split())
flag = 0

for i in range(N):
  total += L[i]

for i in range(N):
  if A[i]*2 >= total:
    print("No")
    flag = 1
    break

if flag == 0:
  print("Yes")

### FIXED CODE ###

N = int(input())
L = input().split()
max = 0
count = 0

for i in range(N):
  count += int(L[i])
  if max < int(L[i]):
    max = int(L[i])
    
if count > 2*max:
  print("Yes")
else:
  print("No")
n = int(input())
a = list(map(int, input().split()))
ans = 1

while True:
  if a%2 == 1:
    print(0)
  print(ans)
  ans += 1

### FIXED CODE ###

s = input()
s1 = int(s[0])
s2 = int(s[1])
s3 = int(s[2])

print(s1 + s2+s3)
S=input()
max=0
count=0
for i in range(len(S)):
  if S[i] == "A" or S[i] == "T" or S[i] == "C" or S[i] == "G":
    count+=1
    if max<count:
    max=count
  else:
    count=0
print(max)

### FIXED CODE ###

S=list(input())
max=0
count=0
for i in range(len(S)):
  if S[i] == "A" or S[i] == "T" or S[i] == "C" or S[i] == "G":
    count+=1
    if max<count:
      max=count
  else:
    count=0
print(max)
arr = ['Sunny', 'Cloudy', 'Rainy']
in = input()
ind = (arr.index(in) + 1) % 3
print(arr[ind])


### FIXED CODE ###

arr = ['Sunny', 'Cloudy', 'Rainy']
i = input()
ind = (arr.index(i) + 1) % 3
print(arr[ind])
N = int(input())
N_reverse = N[::-1]

if N == N_reverse:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

N = input()
N_reverse = N[::-1]

if N == N_reverse:
  print('Yes')
else:
  print('No')
a, b, _ = map(int, input().split())
print(a * b / 2)

### FIXED CODE ###

s = int(input())
a = [s]

counter = 2
while True:
    if a[-1] % 2 == 0:
        temp = int(a[-1] / 2)
    else:
        temp = int(3 * a[-1] + 1)
    
    if temp in a:
        break
        
    counter += 1
    a.append(temp)
    
print(counter)
import math

A, B, N = map(int, input().split())

ans = 0
if N == max(A, B, N):
    ans = math.floor((A*N)/B)-A*(N//B)
else:
    if N <= 1000000:
        for x in range(1, N+1):
            tmp = math.floor((A*x)/B)-A*(x//B)
            ans = max(ans, tmp)
    else:
        for x in range(1, 300000):
            tmp = math.floor((A*x)/B)-A*(x//B)
            ans = max(ans, tmp)

        base = N//2-150000
        for x in range(base, base+300000):
            tmp = math.floor((A*x)/B)-A*(x//B)
            ans = max(ans, tmp)

        for x in range(N-300000, N+1):
            tmp = math.floor((A*x/B))-A*(x//B)
            ans = max(ans, tmp)
print(int(ans))


### FIXED CODE ###

K = int(input())
A, B = map(int, input().split())

for i in range(A, B+1):
    if i % K == 0:
        print('OK')
        exit(0)
print('NG')
import math
a, b, c, d = [int(i) for i in input().split()]
"""
print(b // c, b // d, b // ((c * d) // math.gcd(c,d)), (a-1) // c, (a-1) // d, (a-1) // ((c * d) // math.gcd(c,d)))
print((c * d) // math.gcd(c,d))
"""
print(
    b - a + 1 - 
    (b // c + b // d 
        - b // ((c * d) // math.gcd(c,d)) 
    - (a-1) // c - (a-1) // d 
        + (a-1) // ((c * d) // math.gcd(c,d)))
)


### FIXED CODE ###

import fractions
a, b, c, d = [int(i) for i in input().split()]
"""
print(b // c, b // d, b // ((c * d) // fractions.gcd(c,d)), (a-1) // c, (a-1) // d, (a-1) // ((c * d) // fractions.gcd(c,d)))
print((c * d) // fractions.gcd(c,d))
"""
print(
    b - a + 1 - 
    (b // c + b // d 
        - b // ((c * d) // fractions.gcd(c,d)) 
    - (a-1) // c - (a-1) // d 
        + (a-1) // ((c * d) // fractions.gcd(c,d)))
)
a=int(input())

if a>= 1000:
 print("ABD"):
else:
 print("ABC")

### FIXED CODE ###

a=int(input())

if a>= 1000:
 print("ABD")
else:
 print("ABC")
# 02
import sys
import math


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, m = LI()
s = S()
t = S()

gcd = math.gcd(n, m)
l = n * m // gcd
d_s = l // n
d_t = l // m
x = list('*' * l)
is_ok = True

for i in range(n):
    x[d_s * i] = s[i]

for i in range(m):
    if x[d_t * i] != '*':
        if x[d_t * i] != t[i]:
            is_ok = False
            break
    else:
        x[d_t * i] = t[i]

if is_ok:
    ans = len(x)
    print(ans)
else:
    print(-1)


### FIXED CODE ###

# 02
import sys
import math


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, m = LI()
s = S()
t = S()

gcd = math.gcd(n, m)
lcm = n * m // gcd
i_s = n // gcd
i_t = m // gcd
for i in range(gcd):
    if s[i*i_s] != t[i*i_t]:
        print(-1)
        exit()
print(lcm)
#最大公約数を求める
def gcd(a,b):
    #a>bとなるように入れ替え
    if a < b:
        tmp = a
        a = b
        b = tmp
    
    #ユークリッドの互除法
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
    
    return b

#最小公倍数を求める
def lcm(a,b):
    return int((a*b)/gcd(a,b))

#入力
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

#Tのリストの2数のlcmを求めて範囲を広げていく
tmp_lcm = 1 #現在の範囲までのlcm
for i in range(N):
    tmp_lcm = lcm(tmp_lcm,T[i])

print(tmp_lcm)

### FIXED CODE ###

#最大公約数を求める
def gcd(a,b):
    #a>bとなるように入れ替え
    if a < b:
        tmp = a
        a = b
        b = tmp
    
    #ユークリッドの互除法
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
    
    return b

#最小公倍数を求める
def lcm(a,b):
    return int((a*b)//gcd(a,b))

#入力
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

#Tのリストの2数のlcmを求めて範囲を広げていく
tmp_lcm = 1 #現在の範囲までのlcm
for i in range(N):
    tmp_lcm = lcm(tmp_lcm,T[i])

print(tmp_lcm)
sA = raw_input()
idx = sA.index(" ")
a = int(sA[:idx])
b = int(sA[idx+1:]
S = a * b
print S / 3.305785

### FIXED CODE ###

A = map(int, raw_input().split(" "))
S = A[0] * A[1]
print S / 3.305785
import heapq

n, m = map(int, input().split())

# delay, reword
jobs = [list(map(int, input().split())) for i in range(n)]
jobs_days = [[] for i in range(m + 10)]
for job in jobs:
    jobs_days[job[0]].append(-job[1])

reward = 0
h = []
heapq.heapify(h)

for i in range(m):
    for j in jobs_days[i + 1]:
        heapq.heappush(h, j)
    if(len(h)>0):
        reward += heapq.heappop(h)

print(-reward)


### FIXED CODE ###

import heapq

n, m = map(int, input().split())

# delay, reword
jobs = [list(map(int, input().split())) for i in range(n)]
jobs_days = [[] for i in range(m)]
for job in jobs:
    if job[0] - 1 < m:
        jobs_days[job[0] - 1].append(-job[1])

reward = 0
h = []
heapq.heapify(h)

for i in range(m):
    for job in jobs_days[i]:
        heapq.heappush(h, job)
    if len(h) > 0:
        reward += heapq.heappop(h)

print(-reward)
n,m=map(int,input().split())
if n==0: 
    print(int(n*(n-1)/2))
elif m==0:
    print(iint(m*(m-1)/2))
else:
    print(int(n*(n-1)/2+m*(m-1)/2))


### FIXED CODE ###

n,m=map(int,input().split())
if n==0: 
    print(int(m*(m-1)/2))
elif m==0:
    print(int(n*(n-1)/2))
else:
    print(int(n*(n-1)/2+m*(m-1)/2))
N = int(input())
l = 2
r = 1
for i in range(N - 1):
    L = l + r
    l = r
    r = L
print(L)

### FIXED CODE ###

N = int(input())
if N == 1:
    print(1)
else:
    l = 2
    r = 1
    for i in range(N - 1):
        L = l + r
        l = r
        r = L
    print(L)
dN = int(input())
yaku = 1

import math

    



if N % 2 == 0:
	yaku = 2
	
for i in range(3,int(math.sqrt(N))+1 ,1):
	if N % i == 0:
		yaku = i
		
		
yaku2 = int(N/yaku)

print(int(yaku2+yaku - 2))


### FIXED CODE ###

N = int(input())
yaku = 1
import math

if N % 2 == 0:
	yaku = 2
	
for i in range(3,int(math.sqrt(N))+1 ,1):
	if N % i == 0:
		yaku = i
		
		
yaku2 = int(N/yaku)

print(int(yaku2+yaku - 2))
num = int(input())
listt = [input() for i in num]

def hoge(fuga):
    new_list = []
    for i in fuga:
        if int(i) % 2 == 0:
            new_list.append(i)
        else:
            return False
    return new_list


count = 0
while True:
    listt = hoge(listt)
    if listt == False:
        break
    count += 1

print(count)


### FIXED CODE ###

num = input()
listt = input().split()

def hoge(fuga):
    new_list = []
    for i in fuga:
        if int(i) % 2 == 0:
            new_list.append(int(i)/2)
        else:
            return False
    return new_list


count = 0
while True:
    listt = hoge(listt)
    if listt == False:
        break
    count += 1

print(count)
n = input()
A = map(int, raw_input().split())
q = input()
M = map(int, raw_input().split())

def solve(i, m):
if m == 0:
  return True
if i >= n or m > sum(A):
  return False
res = solve(i + 1, m) or solve(i + 1, m - A[i])
return res

for m in M:
   if solve(0,m):
     print "yes"
   else:
     print "no"

### FIXED CODE ###

n = input()
A = map(int, raw_input().split())
q = input()
M = map(int, raw_input().split())

def solve(i, m):
   if m == 0:
     return True
   if i >= n or m > sum(A):
     return False
   res = solve(i + 1, m) or solve(i + 1, m - A[i])
   return res

for m in M:
  if solve(0,m):
     print "yes"
  else:
     print "no"
max = 0
i = 0
j = 0
k = 0
n_max = 6

price = []
for k in range(n_max):
    price.attend(int(raw_input())
    
for i in range(n_max)
    for j in range(k, n_max)
        if max <= price[j] - price[i]:
            max = price[j] - price[i]
print max

### FIXED CODE ###

import sys

n = int(raw_input())

min_R = int(raw_input())
nums = map(int, sys.stdin.readlines())

ans = -10**9

for num in nums:
    if num - min_R > ans:
        ans = num - min_R
    if num < min_R:
        min_R = num
        
print ans
import sys
from sys import flags

h, w, m = map(int, input().split())
row = [0]*h
col = [0]*w
bomb = set()
for x in sys.stdin.readlines():
    H, W = map(int, input().split())
    bomb.add((H-1, W-1))
    row[H-1] += 1
    col[W-1] += 1

maxrow = max(row)
maxcol = max(col)
ans = maxcol + maxrow - 1

p, q = [], []
for i in range(m):
    if bomb[i][0] == maxrow:
        p.append(i)
    if bomb[i][1] == maxcol:
        q.append(i)

for i in p:
    for j in q:
        if (i, j) not in bomb:
            print(ans + 1)
            exit()
print(ans)


### FIXED CODE ###

import sys

h, w, m = map(int, input().split())
row = [0]*h
col = [0]*w
bomb = set()
for x in range(m):
    H, W = map(int, input().split())
    bomb.add((H-1, W-1))
    row[H-1] += 1
    col[W-1] += 1

maxrow = max(row)
maxcol = max(col)
ans = maxcol + maxrow - 1
p, q = [], []
for i in range(h):
    if row[i] == maxrow:
        p.append(i)
for i in range(w):
    if col[i] == maxcol:
        q.append(i)

for i in p:
    for j in q:
        if (i, j) not in bomb:
            print(ans + 1)
            exit()
print(ans)
from collections import deque

N, M = map(int, input().split())

a = deque()
for _ in range(M):
    a.append(int(input()))

before1 = 1
before2 = 0
if len(a)>0:
    ai = a.popleft()

for i in range(N):
    if i == (ai-1):
        before2 = before1
        before1 = 0
        if len(a)>0:
            ai = a.popleft()
    else:
        current = divmod(before1 + before2, 10**9+7)[1]
        before2 = before1
        before1 = current


print(before1)


### FIXED CODE ###

from collections import deque
 
N, M = map(int, input().split())
 
a = []
aindex = 0
for _ in range(M):
    a.append(int(input()))
 
before1 = 1
before2 = 0
ai=0
if len(a)>0:
    ai = a[aindex]
 
for i in range(1, N+1):
    if i == ai:
        before2 = before1
        before1 = 0
        if aindex < len(a)-1:
            aindex += 1
            ai = a[aindex]
    else:
        current = divmod(before1 + before2, 10**9+7)[1]
        before2 = before1
        before1 = current
 
 
print(before1)
N, K = map(int, input().split())
A = list(map(int, input().split()))

def test(m):
    needed = 0
    for a in A:
        needed += (a-1)//m
        if needed > K:
            return False
    return True

lb = 1
ub = max(A)

while True:
    m = (lb + ub) // 2
    if test(m):
        if test(m-1):
            ub = m - 1
        else:
            print(m)
            exit()
    else:
        lb = m + 1

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))

def test(m):
    if m <= 0:
        return False
    needed = 0
    for a in A:
        needed += (a-1)//m
        if needed > K:
            return False
    return True

lb = 1
ub = max(A)

while True:
    m = (lb + ub) // 2
    if test(m):
        if test(m-1):
            ub = m - 1
        else:
            print(m)
            exit()
    else:
        lb = m + 1
N=int(input())
A=int(input())
if N%500<=A：
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N=int(input())
A=int(input())
if N%500<=A:
    print("Yes")
else:
    print("No")
s=input()
for i in range(len(s))
    s[i].replace(x)
print(s)

### FIXED CODE ###

s=input()
print('x'*len(s))
num_strs = input().split()

a = int(num_strs[0])
b = int(num_strs[1] * 100)

print((a * b) // 100)


### FIXED CODE ###

import decimal

a, b = list(map(decimal.Decimal, input().split()))

print(int(a * b))