Harryxun/stf_run huggingface dataset:
N,K=map(int,input().split())
A=list(map(int,input().split()))
MOD=10**9+7
ans=1
p=[]
n=[]
for i in range(N):
    if A[i]<0:
        n.append(A[i])
    else:
        p.append(A[i])
p.sort(reverse=True)
n.sort()
numplus=len(p)
if N==K:
    for i in range(N):
        ans=(ans*A[i])%MOD
elif numplus==0 and K%2==1:
    for i in range(1,K+1):
        ans=(ans*n[i*(-1)])%MOD
else:
    minus=0
    A.sort(reverse=True,key=lambda x:abs(x))
    for i in range(K):
        ans=(ans*A[i])%MOD
        if A[i]<0:
            minus+=1
    if minus%2==1 and ans!=0:
        pwaru=float('inf')
        nwaru=float('inf')
        for i in range(K-1,-1,-1):
            if A[i]>0:
                pwaru=A[i]
            elif A[i]<0:
                nwaru=B[i]
            if pwaru!=float('inf') and nwaru != float('inf'):
                break
        if pwaru==float('inf'):
            pkakeru=float('inf')
            for i in range(K,N):
                if A[i]>=0:
                    pkakeru=A[i]
                    break
            ans=(ans*pkakeru*pow(nwaru,MOD-2,MOD))%MOD
        else:
            pkakeru=0
            for i in range(K,N):
                if A[i]>=0:
                    pkakeru=A[i]
                    break
            nkakeru=0
            for i in range(K,N):
                if A[i]<0:
                    nkakeru=A[i]
                    break
            if nwaru*nkakeru>pwaru*pkakeru:
                ans=(ans*nkakeru*pow(pwaru,MOD-2,MOD))%MOD
            else:
                ans=(ans*pkakeru[i]*pow(nwaru,MOD-2,MOD))%MOD
print(ans)


### FIXED CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
MOD=10**9+7
p=[]
n=[]
for i in range(N):
    if A[i]<=0:
        n.append(A[i])
    else:
        p.append(A[i])
p.sort(reverse=True)
n.sort()
numplus=len(p)
if numplus==0:
    ans=1
    if K%2==1:
        for i in range(1,K+1):
            ans=(ans*n[i*(-1)])%MOD
    else:
        for i in range(K):
            ans=(ans*n[i])%MOD
elif N==K:
    ans=1
    for i in range(N):
        ans=(ans*A[i])%MOD
else:
    if numplus>=K:
        x=K
        if 0 in p:
            zero=p.index(0)
            len(p)-zero-1
    else:
        if (K-numplus)%2==1:
            x=numplus-1
        else:
            x=numplus
    ans=1
    for i in range(x):
        ans=(ans*p[i])%MOD
    for i in range(K-x):
        ans=(ans*n[i])%MOD
    temp=ans
    while x>1:
        if len(n)<(K-x+2):
            break
        if n[K-x]*n[K-x+1]<p[x-1]*p[x-2]:
            break
        temp=(temp*n[K-x]*n[K-x+1])%MOD
        temp=(temp*pow(p[x-1]*p[x-2],MOD-2,MOD))%MOD
        ans=temp
        x-=2
print(ans)
h,w = map(int,input().split())
n = int(input())
aa = list(map(int,input().split()))

ans = [[0]*w for _ in range(h)]
nums = ''

for i in range(n):
  nums += str(i+1)*aa[i]    
  
for i in range(len(nums)):  
  ans[i//w][i%w] = nums[i]  
  
for hi in range(h):
  if hi % 2 == 1:    
    print(' '.join(list(reversed(ans[hi]))))
  else:
    print(' '.join(ans[hi]))  

### FIXED CODE ###

h,w = map(int,input().split())
n = int(input())
aa = list(map(int,input().split()))

ans = [[0]*w for _ in range(h)]
nums = []

for i in range(n):
  for j in range(aa[i]):
    nums.append(i+1)
  
for i in range(len(nums)):  
  ans[i//w][i%w] = nums[i]  
  
for hi in range(h):
  if hi % 2 == 1:    
    print(' '.join(map(str,list(reversed(ans[hi])))))
  else:
    print(' '.join(map(str,ans[hi])))
N,M,Q=map(int,input().split())
v=[[] for _ in range(Q)]
o=0
for i in range(Q):
    v[i]=list(map(int,input().split()))
l=list(itertools.combinations(range(M+N), N))
for x in l:
    s=0
    a=[]
    for i in range(N):
        a.append(x[i]-i)
    for i in range(Q):
        if a[l[i][2]]-a[l[i][1]]-l[i][3]==0:
            s+=l[i][4]
    if s>o:
        o=s
print(o)

### FIXED CODE ###

import itertools
N,M,Q=map(int,input().split())
v=[[] for _ in range(Q)]
o=0
for i in range(Q):
    v[i]=list(map(int,input().split()))
l=list(itertools.combinations(range(M-1+N), N))
for x in l:
    s=0
    a=[]
    for i in range(N):
        a.append(x[i]-i+1)
    for i in range(Q):
        if a[v[i][1]-1]-a[v[i][0]-1]-v[i][2]==0:
            s+=v[i][3]
    if s>o:
        o=s
print(o)
A, B = map(int, input().split())

import math

def func(B, C, D):
    if D >= B:
        print(C)
    else:
        C += 1
        func(B, C, D)
        
if B == 1:
    print(0)

else:
    C = math.ceil(B/A)
    D = (A-1)*(C-1) + A
    func(B, C, D)

### FIXED CODE ###

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

cnt = 0
tap = 1

while tap < B:
    tap += A-1
    cnt += 1
    
print(cnt)
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ll n; cin >> n;
    if(n == 3 || n == 5 || n== 7){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


### FIXED CODE ###

x = int(input())
if x == 3 or x == 5 or x == 7:
    print("YES")
else :
    print("NO")
import sys

sys.stdin = open('d1.in')

inf = 10 ** 20


def solve(n, m, weights):
    score = [-inf] * n
    score[0] = 0
    pred = [-1] * n

    for step in range(n):
        for edge, c in weights.items():
            a, b = edge
            if score[b] < score[a] + c:
                score[b] = score[a] + c
                pred[b] = a

    b = n - 1
    while b != 0:
        a = pred[b]
        c = weights[(a, b)]
        if score[b] < score[a] + c:
            return 'inf'
        b = a
    return score[n-1]


def solve2(n, m, weights):
    score = [-inf] * n
    score[0] = 0
    pred = [-1] * n

    for step in range(n):
        for edge, c in weights.items():
            a, b = edge
            if score[b] < score[a] + c:
                score[b] = score[a] + c
                pred[b] = a

    res = score[n-1]

    for step in range(n):
        for edge, c in weights.items():
            a, b = edge
            if score[b] < score[a] + c:
                score[b] = score[a] + c
                pred[b] = a

    if res < score[n-1]:
        return 'inf'
    return res


def main():
    n, m = map(int, input().split())
    weights = {}
    for _ in range(m):
        a, b, c = map(int, input().split())
        a -= 1
        b -= 1
        weights[(a, b)] = c

    res = solve2(n, m, weights)
    print(res)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

# sys.stdin = open('d1.in')

inf = 10 ** 20


def solve(n, m, weights):
    score = [-inf] * n
    score[0] = 0
    pred = [-1] * n

    for step in range(n):
        for edge, c in weights.items():
            a, b = edge
            if score[b] < score[a] + c:
                score[b] = score[a] + c
                pred[b] = a

    b = n - 1
    while b != 0:
        a = pred[b]
        c = weights[(a, b)]
        if score[b] < score[a] + c:
            return 'inf'
        b = a
    return score[n-1]


def solve2(n, m, weights):
    score = [-inf] * n
    score[0] = 0
    pred = [-1] * n

    for step in range(n):
        for edge, c in weights.items():
            a, b = edge
            if score[b] < score[a] + c:
                score[b] = score[a] + c
                pred[b] = a

    res = score[n-1]

    for step in range(n):
        for edge, c in weights.items():
            a, b = edge
            if score[b] < score[a] + c:
                score[b] = score[a] + c
                pred[b] = a

    if res < score[n-1]:
        return 'inf'
    return res


def main():
    n, m = map(int, input().split())
    weights = {}
    for _ in range(m):
        a, b, c = map(int, input().split())
        a -= 1
        b -= 1
        weights[(a, b)] = c

    res = solve(n, m, weights)
    print(res)

if __name__ == '__main__':
    main()
N, M = map(int, input().split())
a = set(map(int, input().split()))
n = [0] * N
n[0] = 1
n[1] = 2

if 1 in a and N == 1:
    print(0)
    exit()
if 1 in a and 2 in a:
    print(0)
    exit()
if 1 in a:
    n[0] = 0
    n[1] = 1

for i in range(N - 2):
    if i + 3 in a:
        pass
    else:
        n[i + 2] = (n[i + 1] + n[i]) % 1000000007

print(n[N - 1])

### FIXED CODE ###

N, M = map(int, input().split())
a = set([int(input()) for i in range(M)])
n = [0] * (N + 1)
n[0] = 1
n[1] = 1

#listの中をinで探すのはくっそ遅い
if 1 in a:
    n[1] = 0

for i in range(2, N + 1):
    if i in a:
        continue
    else:
        n[i] = (n[i - 1] + n[i - 2]) % 1000000007

print(n[N])
def col(a):
  if a % 2 == 0:
    return a//2
  else:
    return a*3 + 1

s = int(input())

an = [a]
i = 1
while True:
  i += 1
  an_1 = col(a)
  if an_1 in an:
    break
  an.append(an_1)

print(i)

### FIXED CODE ###

def col(a):
  if a % 2 == 0:
    return a//2
  else:
    return a*3 + 1

s = int(input())

an = [s]
i = 1
while True:
  i += 1
  an_1 = col(an[-1])
  if an_1 in an:
    break
  else:
    an.append(an_1)

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

def prime_factorization(x):
    table = []
    i = 2
    while i * i <= x :
        if x % i == 0 :
          	n /= i
            table.append(i)
        i += 1

    if x > 1 :
        table.append(x)
    return table

v = set(prime_factorization(a))
w = set(prime_factorization(b))

print(len(v&w) + 1)


### FIXED CODE ###

a,b = map(int,input().split())
 
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:   
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
  
s = set(prime_decomposition(a))
t = set(prime_decomposition(b))
 
print(len(s&t) + 1)
import heapq as hq
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int,input().split())
    a-=1
    b-=1
    edges[a].append((b,1))
    edges[b].append((a,1))
INF = float("inf")
d = [INF]*N
d[0] = 0
q = [(0,0)]
while q:
    dist, i = hq.heappop(q)
    if d[i] < dist:
        continue
    for j, w in edges[i]:
        if d[j] > d[i]+w:
            d[j] = d[i]+w
            hq.heappush(q, (d[j], j))
def cnt(n,m):
    ret = 1
    for v,_ in edges[n]:
        if v != m and not visited[v]:
            visited[v] = True
            ret += cnt(v,m)
    return ret
visited = [False]*N
visited[0] = True
fnc = cnt(0,N-1)
visited = [False]*N
visited[N-1] = True
snk = cnt(N-1,0)
if d[N-1] % 2 == 0:
    snk -= 1
print("Fennec" if snk < fnc else "Snuke")

### FIXED CODE ###

import heapq as hq
from collections import deque
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int,input().split())
    a-=1
    b-=1
    edges[a].append((b,1))
    edges[b].append((a,1))
INF = float("inf")
d = [INF]*N
d[0] = 0
prev = [None]*N
q = [(0,0)]
while q:
    dist, i = hq.heappop(q)
    if d[i] < dist:
        continue
    for j, w in edges[i]:
        if d[j] > d[i]+w:
            d[j] = d[i]+w
            prev[j] = i
            hq.heappush(q, (d[j], j))
path = deque()
i = N-1
while prev[i] != 0:
    path.append(prev[i])
    i = prev[i]
fncq = deque([0])
snkq = deque([N-1])
fnc = 1
snk = 1
visited = [False]*N
visited[0] = True
visited[N-1] = True
while path:
    v = path.pop()
    fncq.append(v)
    visited[v] = True
    fnc += 1
    if path:
        v = path.popleft()
        snkq.append(v)
        visited[v] = True
        snk += 1
po = [fncq, snkq]
while fncq or snkq:
    for i in range(2):
        q = po[i]
        if q:
            v = q.popleft()
            for w,_ in edges[v]:
                if not visited[w]:
                    visited[w] = True
                    q.append(w)
                    if i == 0:
                        fnc += 1
                    else:
                        snk += 1
print("Fennec" if fnc > snk else "Snuke")
n=int(input())

if "7" in n:
  print("Yes")
  
else:
  print("No")

### FIXED CODE ###

n=input()

if "7" in n:
  print("Yes")
  
else:
  print("No")
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
q=i1()
import math
for i in range(q):
 [a,b]=i2()
 x=a*b
 c=int(math.sqrt(x))
 if c**2==x:
    c-=1
 z=2*c
 if  (x//c)==c:
   z-=1
 if x%c==0 and (x//c-1)==c:
   z-=1
 if a<=c:
   z-=1
 if b<=c:
   z-=1
 print(z)

### FIXED CODE ###

def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
q=i1()
import math
y=[]
for i in range(q):
 y.append(i2())

for a,b in y:
 x=a*b
 c=int(math.sqrt(x))
 if c**2==x:
    c-=1
 z=2*c
 if c>0 and (x//c)==c:
   z-=1
 if c>0 and x%c==0 and (x//c-1)==c:
   z-=1
 if a<=c:
   z-=1
 if b<=c:
   z-=1
 print(z)
print("A" if input()isupper() else "a")

### FIXED CODE ###

from math import pi
r = float(input())
print(r*2* pi)
import sys
input = sys.stdin.readline
N = int(input())


node = [0 for i in range(N)]
neigh = [[] for j in range(N)]
ans = [0 for i in range(N)]
visited = [0 for i in range(N)]
k = 1

for i in range(N-1):
    ai,bi = map(int,input().split())
    node[ai-1] += 1
    node[bi-1] += 1
    neigh[ai-1].append(bi-1)
    neigh[bi-1].append(ai-1)
c = list(map(int,input().split()))
c.sort(reverse=True)

def dfs(neighbor,start,visited):
    global k
    global c
    if sum(visited) == N:
        return 0
    for i in neighbor[start]:
        if visited[i] == 0:
            ans[i] = c[k]
            k += 1
            visited[i] = 1
            dfs(neighbor,i,visited)
        else:
            continue

m = max(node)
nn = node.index(m)
#nn = [node[i] for i in range(N) if node[i] == m][0]
visited[nn] = 1
ans[nn] = max(c)
if N == 1:
    print(100)
    print(' '.join([str(i) for i in range(N)]))
    exit()
dfs(neigh,nn,visited)

ans2 = ' '.join([str(ans[i]) for i in range(N)])


print(sum(c)-max(c))
print(ans2)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
N = int(input())


node = [0 for i in range(N)]
neigh = [[] for j in range(N)]
ans = [0 for i in range(N)]
visited = [0 for i in range(N)]
k = 1

for i in range(N-1):
    ai,bi = map(int,input().split())
    node[ai-1] += 1
    node[bi-1] += 1
    neigh[ai-1].append(bi-1)
    neigh[bi-1].append(ai-1)
c = list(map(int,input().split()))
c.sort(reverse=True)
flag = False
def dfs(neighbor,start):
    global flag
    global k
    if sum(visited) == N:
        return 0

    for i in neighbor[start]:
        
        if visited[i] == 0:
            ans[i] = c[k]
            k += 1
            visited[i] = 1
            try:
                dfs(neighbor,i)
            except RuntimeError:
                flag = True
                return 0




m = max(node)
nn = node.index(m)
#nn = [node[i] for i in range(N) if node[i] == m][0]
visited[nn] = 1
ans[nn] = max(c)

dfs(neigh,nn)
"""
if flag:
    print(100)
    print(' '.join([str(i) for i in range(N)]))
    exit()
"""
ans2 = ' '.join([str(ans[i]) for i in range(N)])


print(sum(c)-max(c))
print(ans2)
n = input().split()
x = int(n[0])
y = int(n[1])
if x == y:
    print(x * y + " " + x * 4)
else
    print(x * y + " " + (x + y) * 2)

### FIXED CODE ###

x,y = map(int, input().split())
print(x * y, (x + y) * 2)
K,N=map(int,input().split())
A=list(map(int,input().split()))
d=0
for i in range(N-1):
  b=A[i+1]-A[i]
  if d == 0 and A[i+1]-A[0] >= K/2:
    d=d+A[i]-A[0]+K-A[i+1]
if d == 0:
  d=d+A[N-1]
print(d)

### FIXED CODE ###

S=input()
if S[2] == S[3] and S[4] == S[5]:
  print("Yes")
else:
  print("No")
from scipy.special import comb
N,K=list(map(int,input().split()))
mod=10**9+7
red=N-K
for i in range(1,K+1):
   print(int(comb(red+1,i)*pow(i,K-i)%mod))

### FIXED CODE ###

from scipy.special import comb
N,K=list(map(int,input().split()))
mod=10**9+7
red=N-K
for i in range(1,K+1):
   tmp=comb(N-K+1,i,exact=True)*comb(K-1,i-1,exact=True)%mod
   print(tmp)
heck = int(input().replace(" ",""))
print("Yes" if (check**0.5)%1==0 else "No" )

### FIXED CODE ###

check = int(input().replace(" ",""))
print("Yes" if (check**0.5)%1==0 else "No" )
#coding:utf-8
N,M=map(int,raw_input().split())
A=map(int,raw_input().split())
dp=[-1 for i in range(N + 1)]
Cost={(i+1):v for i,v in enumerate([2,5,5,4,5,6,3,7,6])}

for a in A:
    dp[Cost[a]]=1
for n in range(2,N+1):
    for a in A:
        if dp[n-Cost[a]] != -1:
            dp[n]=max(dp[n], dp[n-Cost[a]]+1)
k=dp[N]
n=N
buf=[]
for i in range(dp[N]-1):
    b=-1
    for a in A:
        if dp[n-Cost[a]] == k-1:
            b=max(b,a)
    k-=1
    n-=Cost[b]
    buf.append(b)
b=-1
for a in A:
    if Cost[a] == n:
        b=max(b,a)
buf.append(b)
print("".join(map(str,buf)))







### FIXED CODE ###

#coding:utf-8
N,M=map(int,raw_input().split())
A=map(int,raw_input().split())
dp=[-1 for i in range(10**4 + 1)]
Cost={(i+1):v for i,v in enumerate([2,5,5,4,5,6,3,7,6])}

for a in A:
    dp[Cost[a]]=1
for n in range(2,N+1):
    for a in A:
        if n-Cost[a]>=0 and dp[n-Cost[a]] != -1:
            dp[n]=max(dp[n], dp[n-Cost[a]]+1)
k=dp[N]
n=N
buf=[]
for i in range(dp[N]-1):
    b=-1
    for a in A:
        if n-Cost[a]>=0 and dp[n-Cost[a]] == k-1:
            b=max(b,a)
    k-=1
    n-=Cost[b]
    buf.append(b)
b=-1
for a in A:
    if Cost[a] == n:
        b=max(b,a)
buf.append(b)   
print("".join(map(str,buf)))
n = int(input())

cnt_ac = 0
cnt_tle = 0
cnt_wa = 0
cnt_re = 0

for i in range(n):
    if input() == "AC":
        cnt_ac += 1
    elif input() == "TLE":
        cnt_tle += 1
    elif input() == "WA":
        cnt_wa += 1
    elif input() == "RE":
        cnt_re += 1

print("AC ×　" + cnt_ac)
print("WA ×　" + cnt_wa)
print("TLE ×　" + cnt_tle)
print("RE ×　" + cnt_re)


### FIXED CODE ###

n = int(input())
S = []
for i in range(n):
    S.append(input())
cnt_ac = 0
cnt_tle = 0
cnt_wa = 0
cnt_re = 0


for i in range(n):
    if S[i] == "AC":
        cnt_ac += 1
    elif S[i] == "TLE":
        cnt_tle += 1
    elif S[i] == "WA":
        cnt_wa += 1
    elif S[i] == "RE":
        cnt_re += 1

print("AC x " + str(cnt_ac))
print("WA x " + str(cnt_wa))
print("TLE x " + str(cnt_tle))
print("RE x " + str(cnt_re))
dishes = [int(input()) for _ in range(5)]

dishes = sorted(dishes, key=lambda x: 10 - int(str(x)[-1]))
a = list()
b = list()
for d in dishes:
    if d % 10 == 0:
        a.append(d)
    else:
        b.append(d)
b = [d + 10 - d % 10 for d in b[:-1]] + [b[-1]]
dishes = a + b
# print(sum(dishes))
#
print(1)


### FIXED CODE ###

dishes = [int(input()) for _ in range(5)]

dishes = sorted(dishes, key=lambda x: 10 - int(str(x)[-1]))
a = list()
b = list()
for d in dishes:
    if d % 10 == 0:
        a.append(d)
    else:
        b.append(d)
if len(b) > 0:
    b = [d + 10 - d % 10 for d in b[:-1]] + [b[-1]]
dishes = a + b
print(sum(dishes))
N, A, B = map(int, input().split())
blue = 'b' * A
red = 'r' * B
str = ''

for _ in range(N):
  for i in range(A):
    if len(str) < N:
      str += blue
  for j in range(B):
    if len(str) < N:
      str += red

print(str.count('b'))

### FIXED CODE ###

N, A, B = map(int, input().split())
print((N // (A + B) * A) + min(A, N % (A + B)))
N, K = map(int, input().split())
L = list(map(int, input().split()))
dp = [-1 for k in range(K+1)]
dp[0] = 0
def fn(n):
	if dp[n] != -1:
		return dp[n]
	if n < L[0]:
		dp[n] = 1
		return 1
	if n in L:
		dp[n] = 0
		return 0
	for i in L:
		if fn(n-i) == 1:
			dp[n] = 0
			return 0
	dp[n] = 1
	return 1
for i in range(K):
	fn(i)
if fn(K) == 0:
	print("First")
else:
	print("Second")

### FIXED CODE ###

N, K = map(int, input().split())
L = list(map(int, input().split()))
dp = [-1 for k in range(K+1)]
# dp[0] = 1
def fn(n):
	if dp[n] != -1:
		return dp[n]
	if n == 0:
		dp[n] = 0
		return dp[n]
	ans = 0
	for i in L:
		if n >= i:
			if fn(n-i) == 0:
				ans = 1
				break
	dp[n] = ans		
	return dp[n]
for l in range(K):
	fn(l)
if fn(K) == 1:
	print("First")
else:
	print("Second")
A,B,C,X,Y = map(int,input().split())

if X>Y:
    print(min( A*X+B*Y , 2*C*X , 2*C*Y+A*(X-Y)))
else:
    print(min( A*X+B*Y , 2*C*Y , 2*C*X+A*(Y-X)))


### FIXED CODE ###

ans=700
for i in list(input()):
    if i=='o':
        ans += 100
print(ans)
A, B = map(int, input().split())

white = '.'
black = '#'
grid = [[black * 100] for i in range(50)] + [[white * 100] for i in range(50)]

for i in range(A-1):
    print(grid[(i % 50) * 2][0][:(i % 50) * 2])
    grid[(i % 50) * 2][0] = grid[(i % 50) * 2][0][:(i % 50) * 2] + white + grid[(i % 50) * 2][0][(i % 50) * 2 + 1:]

for i in range(B-1):
    print(grid[(i % 50) * 2+49][0][:(i % 50) * 2])
    grid[(i % 50) * 2+49][0] = grid[(i % 50) * 2+49][0][:(i % 50) * 2] + black + grid[(i % 50) * 2+49][0][(i % 50) * 2 + 1:]

print(100, 100)
for g in grid:
    print(g)

### FIXED CODE ###

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

white = '.'
black = '#'
grid = [[black * 100] for i in range(50)] + [[white * 100] for i in range(50)]

for i in range(A-1):
    grid[(i // 50)*2][0] = grid[(i // 50)*2][0][:(i % 50) * 2] + white + grid[(i // 50)*2][0][(i % 50) * 2 + 1:]

for i in range(B-1):
    grid[(i // 50)*2 + 51][0] = grid[(i // 50)*2 + 51][0][:(i % 50) * 2] + black + grid[(i // 50)*2 + 51][0][(i % 50) * 2 + 1:]

print(100, 100)
for g in grid:
    print(g[0])
import math
Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)
c_min = int(a/c) if a % c == 0 else int(a/c) + 1
c_max = int(b/c)
delta_c = c_max - c_min + 1
d_min = int(a/d) if a % c == 0 else int(a/d) + 1
d_max = int(b/d)
delta_d = d_max - d_min + 1
cd = int((c * d) / math.gcd(c, d))
cd_min = int(a/cd) if a % c == 0 else int(a/cd) + 1
cd_max = int(b/cd)
delta_cd = cd_max -cd_min + 1
print( b-a+1 - (delta_c + delta_d - delta_cd), end='')

### FIXED CODE ###

# 同じ数字が連続していないこと
passward = input()


def detector(passward):
    passward_list = list(passward)
    for i in range(len(passward)-1):
        if passward_list[i] == passward_list[i+1]:
            print('Bad', end='')
            break
        else :
            if i == len(passward)-2:
                print('Good', end='')
            continue
        

detector(passward)
import numpy as np

s = input()

# print(s)

ans = np.zeros((len(s)+1, len(s)+1), dtype = np.int)

# print(ans)

if len(s) >= 4:
  for i in range (0, len(s) - 3):
    for j in range (i + 4, len(s)+1):
      num = int(s[i:j])
      # print(num)
      if num % 2019 == 0:
        ans[i, j] += 1

# print(ans)

print(np.sum(ans))

### FIXED CODE ###

s, w = map(int, input().split())

ans = 'unsafe'

if s > w:
  ans = 'safe'

print(ans)
N = int(input())
T, A = map(int, input().split())
for i in range(N-1):
    t, a = map(int, input().split())
    n = max(-(-T//t), -(-A//a))
    T, A = n * t, n, * a
print(T+A)

### FIXED CODE ###

N = int(input())
T, A = map(int, input().split())
for i in range(N-1):
    t, a = map(int, input().split())
    n = max(-(-T//t), -(-A//a))
    T, A = n * t, n * a
print(T+A)
if 1<=A<=9:
  if 1<=B<=9:
    C=A*B
    print(C)
  else print(-1)
else print(-1)

### FIXED CODE ###

A,B=map(int,input().split())
if 1<=A<=9:
        if 1<=B<=9:
            print(A*B)
        else:
            print(-1)
else: print(-1)
n = int(input())
a = int(input())
Max = -999999
Min = a
for i in range(n):
    x = int(input())
    if (Max < x - Min):
        Max = x - Min
    if (x < Min):
        Min = x
print(Max)

### FIXED CODE ###

n = int(input())
a = int(input())
Max = -10 ** 9
Min = a
for i in range(n-1):
    x = int(input())
    if (Max < x - Min):
        Max = x - Min
    if (x < Min):
        Min = x
print(Max)
N, K = map(int, input().split())
s = ""
for _ in range(N):
  a,b = map(int, input().split())
  s += (str(a)+" ")*b
print(sorted(s.split())[K-1])

### FIXED CODE ###

N, K = map(int, input().split())
l = sorted([tuple(map(int, input().split()))for _ in range(N)], key=lambda x:x[0])
c = 0
for i in l:
  c += i[1]
  if c >= K:
    print(i[0])
    break
x,y=input().split()
print('<' if x<y else if x==y '=' else '>')

### FIXED CODE ###

x,y=input().split()
print('<' if x<y else ('=' if x==y else '>'))
Print("Yes")

### FIXED CODE ###

a, b = map(int, input().split(" "))
if a % 2 == 1 and b % 2 == 1:
    print ("Yes")
else:
    print ("No")
table2 = {n:0 for n in "abcdefghijklmnopqrstuvwxyz"}
while True:
    x = str(input().lower())
    if x == False:
        break

    for i in x:
        if i in table2:
            table2[i] += 1

for m,n in table2.items():
    print("{0} : {1}".format(m,n))

### FIXED CODE ###

s=''
while True:
    try:
        s += input().lower()
    except:
        break
 
alph = "abcdefghijklmnopqrstuvwxyz"
 
for a in alph:
    print("{} : {}".format(a, s.count(a)))