Harryxun/stf_run huggingface dataset:
N, K = map(int, input().split())
A = list(map(int, input().split()))
p = 10**9 + 7
ans = 1

is_all_neg = 1
for i in range(N):
    if A[i] > 0:
        is_all_neg = 0
        
if is_all_neg:
    if K%2 == 1:
        A_1 = sorted(A, reverse=True)
        for i in range(K):
            ans *= A_1[i]
        print(ans % p)
    else:
        A_1 = sorted(A)
        for i in range(K):
            ans *= A_1[i]
        print(ans % p)
else:
    A_1 = sorted(A, key=lambda x: abs(x), reverse=True)
    is_pos = 1
    ans = 1
    minus = []
    for i in range(K):
        ans *= A_1[i] % p
        if A_1[i] < 0:
            minus.append(i)
        if ans > 0:
            is_pos = 1
        else:
            is_pos = 0
        if i == K-1:
            if is_pos:
                
                break
            else:
                idx = minus.pop()
                ans /= A_1[idx]
                for j in range(K, N):
                    if A_1[j] > 0:
                        ans *= A_1[j]
                        break
    print(int(ans)%p)
                

### FIXED CODE ###

N, K = map(int, input().split())
X = list(map(int, input().split()))
MOD = 10 ** 9 + 7
 
pos = sorted(v for v in X if v >= 0)
neg = sorted(-v for v in X if v < 0)
if N == K:
    ans = 1
    for x in X:
        ans *= x
        ans %= MOD
    print(ans % MOD)
    exit()
ok = False  # True: ans>=0, False: ans<0
if pos:
    #正の数があるとき
    ok = True
else:
    #全部負-> Kが奇数なら負にならざるをえない。
    ok = (K % 2 == 0)
 
ans = 1
if ok:
    # ans >= 0
    if K % 2 == 1:
        #Kが奇数の場合初めに1つ正の数を掛けておく
        #こうすれば後に非負でも負でも2つずつのペアで
        #考えられる
        ans = ans * pos.pop() % MOD
 
    # 答えは非負になる→二つの数の積は必ず非負になる．
    cand = []
    while len(pos) >= 2:
        x = pos.pop() * pos.pop()
        cand.append(x)
 
    while len(neg) >= 2:
        x = neg.pop() * neg.pop()
        cand.append(x)
 
    cand.sort(reverse=True) # ペアの積が格納されているので必ず非負
    # ペア毎に掛けていく
    for i in range(K // 2):
        ans = ans * cand[i] % MOD
else:
    # ans <= 0
    cand = sorted(X, key=lambda x: abs(x))
    for i in range(K):
        ans = ans * cand[i] % MOD
 
print(ans)
import sys
from itertools import accumulate

n, t = map(int, input().split())
constant = []
variable = []
for line in sys.stdin:
    a, b = map(int, line.split())
    if a == 0:
        constant.append(b + 1)
    else:
        variable.append((a / (b + 1), a, b))
constant.sort()
variable.sort(reverse=True)
INF = 10 ** 10
t += 1
t2 = t.bit_length() + 1
# dp[j]: (i番目まで見て) j件の店で買い物を完了した時の、次の店に到着できる最短時間
dp = [INF] * t2
dp[0] = 1
for _, a, b in variable:
    for j in range(t2 - 1, -1, -1):
        if dp[j] == INF:
            continue
        tmp = (a + 1) * dp[j] + b + 1
        if tmp > t:
            continue
        if dp[j + 1] > tmp:
            dp[j + 1] = tmp

const_acc = list(accumulate(constant))
ans = 0

k = len(constant) - 1
for i, c in enumerate(dp):
    if c == INF:
        break
    remaining = t - c
    while const_acc[k] <= remaining:
        k -= 1
    ans = max(ans, i + k + 1)

print(ans)


### FIXED CODE ###

import sys
from bisect import bisect
from itertools import accumulate

n, t = map(int, input().split())
constant = []
variable = []
for line in sys.stdin:
    a, b = map(int, line.split())
    if a == 0:
        constant.append(b + 1)
    else:
        variable.append((a / (b + 1), a, b))
constant.sort()
variable.sort(reverse=True)
INF = 10 ** 10
t += 1
t2 = t.bit_length() + 1
# dp[j]: (i番目まで見て) j件の店で買い物を完了した時の、次の店に到着できる最短時間
dp = [INF] * t2
dp[0] = 1
for _, a, b in variable:
    for j in range(t2 - 1, -1, -1):
        if dp[j] == INF:
            continue
        tmp = (a + 1) * dp[j] + b + 1
        if tmp > t:
            continue
        if dp[j + 1] > tmp:
            dp[j + 1] = tmp

const_acc = list(accumulate(constant))
ans = 0

for i, c in enumerate(dp):
    if c == INF:
        break
    remaining = t - c
    k = bisect(const_acc, remaining)
    ans = max(ans, i + k)

print(ans)
class Dice:

u,s,e,w,n,b = map(int,input().split())
roll = input()
for i in roll:
	if roll[i] == E:
		tmp = e
		e = u
		u = w
		w = b
		b = tmp
	elif roll[i] == S:
		tmp = s
		s = u
		u = n
		n = b
		b = tmp
	elif roll[i] == W:
		tmp = w
		w = u
		u = e
		e = b
		b = tmp
	elif roll[i] == N:
		tmp = n
		n = u
		u = s
		s = b
		b = tmp

print(u)

### FIXED CODE ###

class Dice:
    u, s, e, w, n, b = map(int, input().split())
    roll = input()
    for i in roll:
        if i == "E":
            e,u,w,b = u,w,b,e
        elif i == "S":
            s,u,n,b = u,n,b,s
        elif i == "W":
            w,u,e,b = u,e,b,w
        elif i == "N":
            n,u,s,b = u,s,b,n
    print(u)

dice = Dice()
N, K = map(int, input().split())
S = input()
c = 0
for i in range(1, N):
  if s[i] == S[i - 1]:
    c += 1
print(min(N - 1, c + K * 2))


### FIXED CODE ###

N, K = map(int, input().split())
S = input()
c = 0
for i in range(1, N):
  if S[i] == S[i - 1]:
    c += 1
print(min(N - 1, c + K * 2))
s=input()
a = list(map(int,input().split()))
x=len(a)
i=0
for k in range 1000000000:
    i=i+1
    for i in range x:
        a[i]=0.5*a[i]
        if a[i]%2=1:
            break
    else:
        continue
    break
h=i-1
print(h)



### FIXED CODE ###

s=input()
a = list(map(int,input().split()))
x=len(a)
f=0
for k in range(1000000000):
    f=f+1
    for i in range(x):
        if a[i]%2 == 1:
            break
        a[i]=0.5*a[i]
    else:
        continue
    break
print(f-1)
T = [int(a) for a in input().split()]
if (T[0]*T[1])%2 == 0:
  	print("No")
else
	print("Yes")

### FIXED CODE ###

T = [int(a) for a in input().split()]
if (T[0]*T[1])%2 == 0:
  	print("No")
else:
	print("Yes")
def dfs(s):
    visited[s]=1
    for v in adj[s]:
        if v not in visited:
            if (s,v) in we:
                y[v]=y[s]+we[(s,v)]
            elif (v,s) in we:
                y[v]=y[s]+we[(v,s)]
            dfs(v)
n=int(input())
adj={}
we={}
visited={}
y=[0]*(n+1)
for q in range(n-1):
    a,b,w=map(int,input().split())
    if a not in adj:
        adj[a]=[b]
    else:
        adj[a].append(b)
    if b not in adj:
        adj[b]=[a]
    else:
        adj[b].append(a)
    we[(a,b)]=w
if n>1:
	dfs(1)
for i in range(1,n+1):
    if y[i]%2==0:
        print(0)
    else:
        print(1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
def dfs(s):
    visited[s]=1
    for v in adj[s]:
        if v not in visited:
            if (s,v) in we:
                y[v]=y[s]+we[(s,v)]
            elif (v,s) in we:
                y[v]=y[s]+we[(v,s)]
            dfs(v)
n=int(input())
adj={}
we={}
visited={}
y=[0]*(n+1)
for q in range(n-1):
    a,b,w=map(int,input().split())
    if a not in adj:
        adj[a]=[b]
    else:
        adj[a].append(b)
    if b not in adj:
        adj[b]=[a]
    else:
        adj[b].append(a)
    we[(a,b)]=w
if n>1:
	dfs(1)
for i in range(1,n+1):
    if y[i]%2==0:
        print(0)
    else:
        print(1)
n=int(input());a=list(map(int,input().split()));b=[];c=0
for i in range(n-1):
	if a[i]>=a[i+1]:
		c+=1;b.append(c)
	else:
		c=0
print(max(b))

### FIXED CODE ###

n=int(input());a=list(map(int,input().split()));b=[0];c=0
for i in range(n-1):
	if a[i]>=a[i+1]:
		c+=1;b.append(c)
	else:
		c=0
print(max(b))
H=int(input())
def f(H):
  if H==1:
    return 1
  elif H>1:
    return 2*f(H/2)+1
print(f(H))

### FIXED CODE ###

H=int(input())
def f(H):
  if H==1:
    return 1
  elif H>1:
    return 2*f(H//2)+1
re=0
re=f(H)
print(re)
import math
a,b = map(int,input().split())
print(math.floor(a*b))

### FIXED CODE ###

a,b = map(str, input().split())
a = int(a)
b = int(b.replace(".",""))
print(a*b//100)
s = input()
a = 'dream'
b = 'dreamer'
c = 'erase'
d = 'eraser'
while True:
    # 後ろから文字列検索
    # 合ったらその文字を削除
    D = hantei(s, d)
    if D > -1:
        s = s[:-len(d)]
        continue
    B = hantei(s, b)
    if B > -1:
        s = s[:-len(b)]
        continue
    C = hantei(s, c)
    if C > -1:
        s = s[:-len(c)]
        continue
    A = hantei(s, a)
    if A > -1:
        s = s[:-len(a)]
        continue
    if len(s) == 0:
        print('YES')
    else:
        print('NO')
    break


def hantei(s, h):
    try:
        slen = len(s)
        hlen = len(h)
        res = s.index(h, slen - hlen, slen + 1)
        return res
    except ValueError as e:
        return -1

### FIXED CODE ###

def hantei(s, h):
    try:
        slen = len(s)
        hlen = len(h)
        res = s.index(h, slen - hlen, slen + 1)
        return res
    except ValueError as e:
        return -1


def resolve():
    s = input()
    a = 'dream'
    b = 'dreamer'
    c = 'erase'
    d = 'eraser'
    while True:
        # 後ろから文字列検索
        # 合ったらその文字を削除
        D = hantei(s, d)
        if D > -1:
            s = s[:-len(d)]
            continue
        B = hantei(s, b)
        if B > -1:
            s = s[:-len(b)]
            continue
        C = hantei(s, c)
        if C > -1:
            s = s[:-len(c)]
            continue
        A = hantei(s, a)
        if A > -1:
            s = s[:-len(a)]
            continue
        if len(s) == 0:
            print('YES')
        else:
            print('NO')
        break
        
resolve()
from collections import defaultdict
g = defaultdict(list)
visited = defaultdict(bool)
N = int(input())
ans = [0] * N

def dfs(v, d=0):
    if visited[v]:
        return
    visited[v] = True
    if d % 2:
        ans[v-1] = 1
    for c,w in g[v]:
        dfs(c, d+w)

for j in range(N-1):
    u,v,w = map(int, input().split())
    g[u].append((v, w))
    g[v].append((u, w))

dfs(1)

for a in ans:
    print(a)

### FIXED CODE ###

from sys import setrecursionlimit, getrecursionlimit
setrecursionlimit(getrecursionlimit()*10000)
from collections import defaultdict
g = defaultdict(list)
visited = defaultdict(bool)
N = int(input())
ans = [0] * N

def dfs(v, d=0):
    if visited[v]:
        return
    visited[v] = True
    if d % 2:
        ans[v-1] = 1
    for c,w in g[v]:
        dfs(c, d+w)

for j in range(N-1):
    u,v,w = map(int, input().split())
    g[u].append((v, w))
    g[v].append((u, w))

dfs(1)

for a in ans:
    print(a)
if input().islower():
	return 'a'
 else:
  	return 'A'

### FIXED CODE ###

n = input()

if n.isupper():
    print('A')
else:
    print('a')
H, W = map(int, input().split())

s = ['#' * (W + 2)] + ['#' + input() + '#' for i in range(H)] + ['#' * (W + 2)]

# m : そこにたどり着くために必要な白マスの数
m = [[-1 for x in range(W+2)] for y in range(H+2)]
m[1][1] = 1


from collections import deque
qx = deque([1])
qy = deque([1])

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]


while len(qx) > 0:
    x, y = qx.popleft(), qy.popleft()
    for d in range(4):
        nx, ny = x + dx[d], y + dy[d]

        # 訪れたことがあるなら調べない
        if m[nx][ny] != -1: continue

        if s[ny][nx] == '.':
            qx.append(nx), qy.append(ny)
            m[ny][nx] = m[y][x] + 1

if m[H][W] == -1:
    print(-1)

else:
    print(sum([c.count('.') for c in s]) - m[H][W])



### FIXED CODE ###

H, W = map(int, input().split())

s = ['#' * (W + 2)] + ['#' + input() + '#' for i in range(H)] + ['#' * (W + 2)]

# m : そこにたどり着くために必要な白マスの数
m = [[-1 for x in range(W+2)] for y in range(H+2)]
m[1][1] = 1


from collections import deque
qx = deque([1])
qy = deque([1])

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]


while len(qx) > 0:
    x, y = qx.popleft(), qy.popleft()
    for d in range(4):
        nx, ny = x + dx[d], y + dy[d]
        # 訪れたことがあるなら調べない
        if m[ny][nx] != -1: continue

        if s[ny][nx] == '.':
            qx.append(nx), qy.append(ny)
            m[ny][nx] = m[y][x] + 1

if m[H][W] == -1:
    print(-1)

else:
    print(sum([c.count('.') for c in s]) - m[H][W])
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)
        self.weight = [0]*(n+1)
 
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            self.root[x] = self.Find_Root(self.root[x])
            self.weight[x] += self.weight[self.root[x]]
            return self.root[x]

    def GetWeight(self, x):
      self.Find_Root(self, x)
      return self.weight[x]

    def Unite(self, x, y, w):
        w += self.GetWeight(x)
        w -= self.GetWeight(y)
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        if(x == y):
            return False

        if self.rnk[x] < self.rnk[y]:
            x, y = y, x
            w = -w
        if self.rnk[x] == self.rnk[y]:
            self.rnk[x] += 1
        
        self.root[y] = x
        self.weight[y] = w

        return True
 
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)
 
    def Count(self, x):
        return -self.root[self.Find_Root(x)]
    
    def Diff(self, x, y):
      if self.isSameGroup(x, y):
        return abs(self.GetWeight(y)- self.GetWeight(xs))
      else:
        return None

def main():
  N, M = map(int, input().split())
  lrd = [list(map(int, input().split())) for _ in range(M)]
  U = UnionFind(N)
  flag = True

  for i in range(M):
    l, r, d = lrd[i]
    U.Unite(l, r, d)
  for i in range(M):
    l, r, d = lrd[i]
    if U.isSameGroup(l, r):
      if U.Diff(l, r) != d:
        print('No')
        exit()
  print('Yes')
  
    
if __name__ == "__main__":
  main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5)
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)
        self.weight = [0]*(n+1)
 
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            r = self.Find_Root(self.root[x])
            self.weight[x] += self.weight[self.root[x]]
            self.root[x] = r
            return r

    def GetWeight(self, x):
      self.Find_Root(x)
      return self.weight[x]

    def Unite(self, x, y, w):
        w += self.GetWeight(x)
        w -= self.GetWeight(y)
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        if(x == y):
            return False

        if self.rnk[x] < self.rnk[y]:
            x, y = y, x
            w = -w
        if self.rnk[x] == self.rnk[y]:
            self.rnk[x] += 1
        
        self.root[y] = x
        self.weight[y] = w

        return True
 
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)
 
    def Count(self, x):
        return -self.root[self.Find_Root(x)]
    
    def Diff(self, x, y):
        return self.GetWeight(y) - self.GetWeight(x)

def main():
  N, M = map(int, input().split())
  lrd = [list(map(int, input().split())) for _ in range(M)]
  U = UnionFind(N)
  for i in range(M):
    l, r, d = lrd[i]
    if not U.isSameGroup(l, r):
      U.Unite(l, r, d)
    else:
      if U.Diff(l, r) != d:
        print('No')
        exit()
  print('Yes')
  
    
if __name__ == "__main__":
  main()
node_num, path_num = map(int, input().split())
graph = [[] for _ in range(node_num)]

for i in range(path_num):
    from_node, to_node = map(int, input().split())
    graph[from_node - 1].append(to_node - 1)
#print(graph)

#dp[i]はiを始点としたときの経路長の最大値
dp = [-1] * node_num

def rec(v):
    #print(v)
    #print(dp)
    if dp[v] > -1:
        return dp[v]
    else:
        dp[v] = 0
        for nv in graph[v]:
            dp[v] = max(dp[v], rec(nv) + 1)
        return dp[v]

ans = 0
for node in range(node_num):
    ans = max(ans, rec(node))
print(ans)

### FIXED CODE ###

import sys
# 許容する再帰処理の回数を変更
sys.setrecursionlimit(10**5+10)
# input処理を高速化する
input = sys.stdin.readline

node_num, path_num = map(int, input().split())
graph = [[] for _ in range(node_num)]

for i in range(path_num):
    from_node, to_node = map(int, input().split())
    graph[from_node - 1].append(to_node - 1)
#print(graph)

#dp[i]はiを始点としたときの経路長の最大値
dp = [-1] * node_num

def rec(v):
    #print(v)
    #print(dp)
    if dp[v] > -1:
        return dp[v]
    else:
        dp[v] = 0
        for nv in graph[v]:
            dp[v] = max(dp[v], rec(nv) + 1)
        return dp[v]

ans = 0
for node in range(node_num):
    ans = max(ans, rec(node))
print(ans)
N, K = map(int,input().split())
def comb(n,k):
    if k < 0:
        return 0
    if k == 0:
        return 1
    return comb(n-1,k-1) * n // k
R = N-K
MOD = 10**9+7
A = K-1
B = R-1
for i in range(1, K+1):
    x = comb(A, i-1)
    y = comb(B, i-2)
    z = comb(B, i-1)
    w = comb(B, i)
    ans = x*(y+2*z+w)
    print(ans % MOD)

### FIXED CODE ###

import sys
sys.setrecursionlimit(3000)
N, K = map(int,input().split())
def comb(n,k):
    if n == 0:
        return 1
    if n < 0:
        return 0
    if k < 0:
        return 0
    if k == 0:
        return 1
    return comb(n-1,k-1) * n // k
R = N-K
MOD = 10**9+7
A = K-1
B = R-1
if N == K:
    print(1)
    for i in range(2, K+1):
        print(0)
else:
    for i in range(1, K+1):
        x = comb(A, i-1)
        y = comb(B, i-2)
        z = comb(B, i-1)
        w = comb(B, i)
        ans = x*(y+2*z+w)
        print(ans % MOD)
# -*- coding: utf-8 -*-

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        for line in sys.stdin:
            lines.append(line)
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    s = lines[0]

    return (s,)


def solve(s):

    w = {'Sunny':'Cloudy', 'Cloudy': 'Rainy', 'Rainy': 'Sunny'}



    return w[s]


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r)
    else:
        print("%s" % result)

if __name__ == '__main__':

    main()
	

### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    s = lines[0]

    return (s,)


def solve(s):

    w = {'Sunny':'Cloudy', 'Cloudy': 'Rainy', 'Rainy': 'Sunny'}



    return w[s]


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()
a,b,c = map(int, raw(input().split)
print len([x for x in range(a,b+1) if c % x == 0])


### FIXED CODE ###

(a,b,c) = map(int, raw_input().split())
print len([x for x in range(a,b+1) if c % x == 0])
import itertools

n=int(input())

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



def amari(a,b):
    x=max(a,b)
    y=min(a,b)
    return x%y

while len(X)>1:
    Y=list(itertools.combinations(X,2))
    Z=[]
    for i in range(len(Y)):
        z=amari(Y[i][0],Y[i][1])
        if z>0:
            Z.append(z)
    X=list(set(Z))
    
print(X[0])

### FIXED CODE ###

n=int(input())
X=list(map(int,input().split()))
x=X[0]
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a


for i in range(1,n):
    x=gcd(x,X[i])
if x!=1:
    print(x)
else:
    print(1)
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
for i  in range(M):
  s[i],c[i]=map(int,input().split())

a=0
for i in range(M-1):
  for j in range(i+1,M):
    if s[i]==s[j] and c[i]!=c[j]:
      a+=1
if a==0:
  u_=[0,0,0]
  for i in range(M):
    u_[s[i]-1]=c[i]
  if max(s)!=3 and N==2:
    if min(s)!=1 and u_[0]==0:
      print(10+u_[1])
    elif min(s)==1 and u_[0]==0:
      print(-1)
    else:
      print(u_[0]*10+u_[1])
  elif N==3:
    if min(s)!=1 and u_[0]==0:
      print(100+u_[1]*10+u_[2])
    elif min(s)==1 and u_[0]==0:
      print(-1)
    else:
      print(100*u_[0]+10*u_[1]+u_[2])
  elif N==1 and max(s)==1 and min(s)==1:
    print(c[0])
  else:
    print(-1)
else:
  print(-1)
    

### FIXED CODE ###

N,M=map(int,input().split())
if M>=1:
    s=[0]*M
    c=[0]*M
    for i  in range(M):
      s[i],c[i]=map(int,input().split())

    a=0
    for i in range(M-1):
       for j in range(i+1,M):
        if s[i]==s[j] and c[i]!=c[j]:
          a+=1
    if a==0:
      u_=[0,0,0]
      for i in range(M):
        u_[s[i]-1]=c[i]
      if max(s)!=3 and N==2:
        if min(s)!=1 and u_[0]==0:
          print(10+u_[1])
        elif min(s)==1 and u_[0]==0:
          print(-1)
        else:
          print(u_[0]*10+u_[1])
      elif N==3:
        if min(s)!=1 and u_[0]==0:
          print(100+u_[1]*10+u_[2])
        elif min(s)==1 and u_[0]==0:
          print(-1)
        else:
          print(100*u_[0]+10*u_[1]+u_[2])
      elif N==1 and max(s)==1 and min(s)==1:
        print(c[0])
      else:
        print(-1)
    else:
      print(-1)
else:
  if N==1:
    print(0)
  else:
      print(10**(N-1))
# -*- coding: utf-8 -*-

import math

N = int(input())
_N = N

size = int (math.log10(N) + 1)

f = 0
while(size > 0):
    if(size > 1):
        f += int(N/(10**(size-1)))
        # print(int(N/(10**(size-1))))
        N %= 10**(size-1)
    else:
        f += N
        # print(N)
    size -= 1

# print(_N, f, _N%f)

if(_N%f == 0):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N, A, B = [int(i) for i in input().split()]

cost = B

if(N*A < B):
    cost = N*A

print(cost)
def main():
    x = int(input())
    a = int(input())
    b = int(input())
    print((x - a) - (b * ((x - a) // b)))


if __name__ == "__main__":
    main()
i

### FIXED CODE ###


def main():
    x = int(input())
    a = int(input())
    b = int(input())
    print((x - a) - (b * ((x - a) // b)))


if __name__ == "__main__":
    main()
from collections import Counter

n = int(input())
v = list(map(int, input().split()))

e = Counter(v[::2]).most_common(2)
o = Counter(v[1::2]).most_common(2)

if e[0][0] != o[0][0]:
    print(n - (e[0][1] + o[0][1]))
else:
    print(n - max(e[0][1]+o[1][1],e[1][1]+o[0][1]))

### FIXED CODE ###

from collections import Counter

n = int(input())
v = list(map(int, input().split()))

# Return the list of 2 most common numbers and each appearance
e = Counter(v[::2]);e[0] = 0
o = Counter(v[1::2]);o[0] = 0

e1,e2 = e.most_common(2)
o1,o2 = o.most_common(2)

if e1[0] != o1[0]:
    print(n - (e1[1] + o1[1]))
else:
    print(n - max(e1[1]+o2[1],e2[1]+o1[1]))
import itertools
import numpy as np

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

a = range(1,M+1)
arr = np.asarray(list(itertools.combinations_with_replacement(a,M))) #重複組み合わせ
#print(arr)

sc = np.zeros(arr.shape[0],dtype=int)
#print(sc)

for i in range(Q):
  abcd = list(map(int, input().split()))
  f = (arr[:,abcd[1]]-arr[:,abcd[0]])==abcd[2]
  sc += abcd[3]*f 
#
print(sc.max())


### FIXED CODE ###

import itertools
import numpy as np

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

a = range(1,M+1)
arr = np.asarray(list(itertools.combinations_with_replacement(a,N))) #重複組み合わせ
#print(arr)

sc = np.zeros(arr.shape[0],dtype=int)
#print(sc)

for i in range(Q):
  abcd = list(map(int, input().split()))
  f = (arr[:,abcd[1]-1]-arr[:,abcd[0]-1])==abcd[2]
  sc += abcd[3]*f 
#
print(sc.max())
n,x,*a=map(int,open(0).read().split());r=0
for i in range(1,N):e=max(a[i]+a[i-1]-x,0);a[i]-=min(e,a[i]);r+=e
print(r)

### FIXED CODE ###

N, x = map(int, input().split())
candies = list(map(int, input().split()))

eat = 0
for i in range(1, N):
    cur = candies[i] + candies[i - 1]
    if cur <= x:
        continue
    eat_i = cur - x
    c = min(eat_i, candies[i])
    candies[i] -= c
    eat += eat_i
print(eat)
colors = input()
l = len(colors)
count1 = 0
for i in range(l):
  count1 += int(colors[i])
 print(min(count1, l-count1))

### FIXED CODE ###

colors = input()
l = len(colors)
count1 = 0
for i in range(l):
	if int(colors[i]) == (i % 2):
		count1 += 1
print(min(count1, l-count1))