Harryxun/stf_run huggingface dataset:
s = [input().split() for i in range(2)]
print(s)

sum_cells_count = s[0][0] * s[0][1]
row_cells_count = s[0][1] * s[1][0]
col_cells_count = s[0][0] - s[1][0]

filled_cells_count = row_cells_count + col_cells_count

return sum_cells_count - filled_cells_count


### FIXED CODE ###

s = [input().split() for i in range(2)]

a, b, c, d = int(s[0][0]), int(s[0][1]), int(s[1][0]), int(s[1][1])

sum_cells_count = a * b
row_cells_count = b * c
col_cells_count = (a - c) * d

filled_cells_count = row_cells_count + col_cells_count

blank_cells_count = sum_cells_count - filled_cells_count
print(blank_cells_count)
n=int(input())
dat = list(map(int, input().split()))
dan = []
for e in dat:
    e = list(str(bin(e)))
    e.reverse()

re = 0
for e in dat:
    re=  e.count('1')
     
     
print(re)
     

 
      
      
             


    
    
     
                

         
           




### FIXED CODE ###

import sys

def main():
    N = int(input())
    A = [int(_) for _ in input().split()]

    t = 0
    while True:
        for i in range(N):
            if A[i] % 2 == 0:
                A[i] //= 2
            else:
                print(t)
                sys.exit()
        t += 1

main()
import collections
 
N=int(input())
D=list(map(int,input().split()))
 
c=collections.Counter(D)
 
max_D=max(D)
ans=1
previous_leaf=1
 
if D[0]!=0:
    ans=0
elif c[0]!=1:
    ans=0
else:
    for i in range(1,max_D+1):
        ans*=(previous_leaf**c[i])
        ans%=998244353
        previous_leaf=c[i]
 
print(ans)
import collections

N=int(input())
D=list(map(int,input().split()))

c=collections.Counter(D)

max_D=max(D)
ans=1
previous_leaf=1

if D[0]!=0:
    ans=0
elif c[0]!=1:
    ans=0
else:
    for i in range(1,max_D+1):
        ans*=(previous_leaf**c[i])
        ans%=998244353
        previous_leaf=c[i]

print(ans)


### FIXED CODE ###

import collections
 
N=int(input())
D=list(map(int,input().split()))
 
c=collections.Counter(D)
 
max_D=max(D)
ans=1
previous_leaf=1
 
if D[0]!=0:
    ans=0
elif c[0]!=1:
    ans=0
else:
    for i in range(1,max_D+1):
        ans*=(previous_leaf**c[i])
        ans%=998244353
        previous_leaf=c[i]
 
print(ans)
n = int(input)

p = 1
for i in range(2, n+1):
  p = p*i%(10**9+7)
print(p)

### FIXED CODE ###

n = int(input())
 
p = 1
for i in range(2, n+1):
  p = p*i%(10**9+7)
print(p)
O = input()
N = input()

pw = ""
if len(O) == len(N):
    for i in range(len(O)):
        pw += O[i] + N[i]
else:
    for i in range(len(O)):
        pw += O[i] + N[i]
    pw += O[-1]
   
print(pw)

### FIXED CODE ###

O = input()
N = input()

pw = ""
if len(O) == len(N):
    for i in range(len(O)):
        pw += O[i] + N[i]
else:
    for i in range(len(O)-1):
        pw += O[i] + N[i]
    pw += O[-1]
   
print(pw)
a=[int(input()) i in range(10)]
a.sort()
a.reverse()
print(a[0:2]) 

### FIXED CODE ###

a=[int(input()) for i in range(10)]
a.sort()
a.reverse()
print(a[0])
print(a[1])
print(a[2])
s = input()
t = input()
if len(s)+1 ==len(t):
	if all(s[i]==t[i] for i in range(len(s))):
    	print("Yes")
else: print("No")


### FIXED CODE ###

s = input()
t = input()
if len(s)+1 ==len(t) and all(s[i]==t[i] for i in range(len(s))):
    print("Yes")
else: print("No")
n = input().split

if len(n) = 7:
  print("Yes")
elif len(n - 1) = 7:
  print("Yes")
elif len(n - 2) = 7:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = int(input())
n = str(n)
  
if n[len(n) - 1] == str("7"):
  print("Yes")
elif n[len(n)- 2] == str("7"):
  print("Yes")
elif n[len(n)- 3] == str("7"):
  print("Yes")
else:
  print("No")
cnt = int(input())
a = []
for i in range(cnt):
    op,n = map(int,input().split())
    if op == 0:
        a.append(n)
    elif op ==1:
        print(a[n])
    else:
        a.pop(-1)


### FIXED CODE ###

cnt = int(input())
a = []
for i in range(cnt):
    li = list(map(int,input().split()))
    if li[0] == 0:
        a.append(li[1])
    elif li[0] ==1:
        print(a[li[1]])
    else:
        a.pop(-1)
N,K,X,Y = map(int,input().split())

print(N)
print(K)
print(X)
print(Y)

### FIXED CODE ###

N,K,X,Y = [int(input()) for i in range(4)]
if N>K:
  total = N*X- (N-K)*(X-Y)
  print(total)
else:
  total = N*X
  print(total)
import sys
from math import *
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
li = na()
mst = li[0]
for i in range(1, n):
    if li[i] > mst:
        mst = li[i]
    elif li[i] != mst - 1:
        print("No")
        exit(1)
print("Yes")


### FIXED CODE ###

import sys
from math import *
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
li = na()
mst = li[0]
flag = "Yes"
for i in range(n):
    if li[i] >= mst:
        mst = li[i]
    elif li[i] != mst - 1:
        flag = "No"
        break
print(flag)
n=int(input())
a=list(map(int,input().split()))
def findMax(a):
    l=len(a)
    if(l==0):
        return 0
    else:
        i=1
        while(i<l):
            if(a[i]>a[i-1]):
                return(max(i,findMax(a[i:])))
            i+=1
        return l

print(findMax(a)-1)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
startpt=0
indexer=0
maxi=0
i=1
while(i<n):
    if(a[i]>a[i-1]):
        maxi=max(i-startpt-1,maxi)
        startpt=i
        
    i+=1
maxi=max(i-startpt-1,maxi)
print(maxi)
from math import acos, hypot, pi


class Point:
    def __init__(self, i, x, y):
        self.i = i
        self.x = int(x)
        self.y = int(y)


class Line:
    def __init__(self, p1, p2):
        self.p1 = p1
        self.p2 = p2
        self.d2 = (p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2
        if p1.x == p2.x:
            self.a = 1
            self.b = 0
        else:
            self.a = p2.y - p1.y
            self.b = p1.x - p2.x
        self.c = -p1.y * self.b - p1.x * self.a

    def dist(self, p):
        f = self.a * p.x + self.b * p.y + self.c
        if f == 0:
            d12 = (self.p1.x - p.x) ** 2 + (self.p1.y - p.y) ** 2
            d22 = (self.p2.x - p.x) ** 2 + (self.p2.y - p.y) ** 2
            if self.d2 < max(d12, d22):
                return None
            return 0
        if f < 0:
            return -1
        else:
            return 1

    def kaku(self, other):
        x = self.a * other.a + self.b * other.b
        x /= hypot(self.a, self.b) * hypot(other.a, other.b)
        return pi - acos(x)


def make_p(n, pp):
    pids = {p.i: [] for p in pp}
    for i in range(n):
        if len(pids[i]) == 2:
            continue
        p1 = pp[i]
        for j in pids:
            if i == j or len(pids[j]) == 2:
                continue
            p2 = pp[j]
            line = Line(p1, p2)
            ptype = {0: 0, 1: 0, -1: 0, None: 0}
            for k in pids:
                if k == i or k == j:
                    continue
                ptype[line.dist(pp[k])] += 1
            if ptype[None]:
                continue
            if ptype[1] == 0 or ptype[-1] == 0:
                pids[i].append(j)
                pids[j].append(i)
    return pids


def main():
    n = int(input())
    if n == 2:
        print(0.5)
        print(0.5)
        return
    pp = []
    for i in range(n):
        p = Point(i, *input().split())
        pp.append(p)
    pids = make_p(n, pp)
    prob = [0.0] * n
    for i, nei in pids.items():
        if len(nei) == 2:
            l1 = Line(pp[i], pp[nei[0]])
            l2 = Line(pp[i], pp[nei[1]])
            kaku = l1.kaku(l2)
            prob[i] += kaku / (2 * pi)
    for p in prob:
        print(p)


if __name__ == '__main__':
    main()


### FIXED CODE ###


def score(s):
    return sum(map(int, s))


def main():
    s = input()
    best = score(s)
    for i in range(1, len(s)):
        ss = int(s) // 10**i * 10**i - 1
        best = max(best, score(str(ss)))
    print(best)


if __name__ == '__main__':
    main()
N, M = map(int, input().split())
E = [[] for _ in range(N)]
for i in range(M):
    x, y = map(int, input().split())
    E[x-1].append(y-1)

dp = [-1]*N


def rec(v):
    if dp[v] != -1:
        return dp[v]
    if len(E[v]) == 0:
        dp[v] = 0
        return dp[v]

    for to in E[v]:
        dp[v] = max(dp[v], rec(to)+1)
    return dp[v]


for i in range(N):
    dp[i] = rec(i)
print(max(dp))

### FIXED CODE ###

import sys
N, M = map(int, input().split())
sys.setrecursionlimit(10**5)
E = [[] for _ in range(N)]
for i in range(M):
    x, y = map(int, input().split())
    E[x-1].append(y-1)

dp = [-1]*N


def rec(v):
    if dp[v] != -1:
        return dp[v]
    if len(E[v]) == 0:
        dp[v] = 0
        return dp[v]

    for to in E[v]:
        dp[v] = max(dp[v], rec(to)+1)
    return dp[v]


for i in range(N):
    dp[i] = rec(i)
print(max(dp))
N, K = map(int, input().split())
A = list(map(int, input().split()))

loop_lis = [1]
visited = [0 for _ in range(N)]
visited[0] = 1
loop_time = 0
start_loop = 0
for i in range(K):
  if visited[A[loop_lis[-1]-1]-1] != 0:
    loop_time = (i+1)-(visited[A[loop_lis[-1]-1]-1])
    start_loop = i+1 - loop_time
    break
  visited[A[loop_lis[-1]-1]-1] = i+1
  loop_lis.append(A[loop_lis[-1]-1])
print(loop_lis[start_loop+(K-start_loop)%loop_time])

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
 
for i in range(N):
  A[i] -= 1

loop_lis = [0]
visited = [-1 for _ in range(N)]
visited[0] = 0
flag = 0
for i in range(K):
  if visited[A[loop_lis[-1]]] != -1:
    loop_time = i+1-visited[A[loop_lis[-1]]]
    start_loop = visited[A[loop_lis[-1]]]
    flag = 1
    break
  visited[A[loop_lis[-1]]] = i+1
  loop_lis.append(A[loop_lis[-1]])

if i == K-1 and flag == 0:
  print(loop_lis[-1]+1)
else:
  print(loop_lis[start_loop+(K-start_loop)%loop_time]+1)
a=[]
while True:
 n=input()
 if n.find('?')>0:break
 a.append(n)
for s in a:
 t=s.split()
 if t[1]=='/':print(int(t[0])//int(t[2]))
 else:print(eval(''.join(t))

### FIXED CODE ###

while 1:
 a=input()
 if'?'in a:break
 print(int(eval(a)))
print(if 'AC' in input())

### FIXED CODE ###

print('Yes' if 'AC' in input() else 'No')
N,K = map(int,input().split())
V = list(map(int,input().split()))
ans = 0
R = min(N,K)
for A in range(R+1):
    for B in range(R-A+1):
        s = V[:A]+V[N-B:]
        #print(s)
        s.sort()
        S = sum(s)
        for k in range(min(K-A-B,len(s))):
            if s[k] < 0:
                S -= s[k]
        ans = max(ans,S)
print(ans)

### FIXED CODE ###

A,P = map(int,input().split())
print((3*A+P)//2)
import math
N = int(input())
A = list(map(int,input().split()))
ls = []
now = A[0]
for i in range(1,N):
    ls.append(math.gcd(now,A[i]))
    now = math.gcd(now,A[i])
if ls.count(1) == N-1:
    print("pairwise coprime")
else:
    if ls[N-1] == 1:
        print("setwise coprime")
    else:
        print("not coprime")

### FIXED CODE ###

import math
import sys
n = int(input())
a = list(map(int, input().split()))

ga = a[0]
for i in range(n):
  ga = math.gcd(ga, a[i])

if ga != 1:
  print("not coprime")
  sys.exit()

m = 1000000
b = [0]*(m+1)
#高速素因数分解
for i in range(2, m):
  if b[i] != 0:
    continue
  j = 1
  while True:
    t = i * j
    if t > m:
      break
    if b[t] == 0:
      b[t] = i
    j += 1
d = {}
for i in a:
  p = i
  #pが1になるまで重複素因子があるかを調べる
  while p != 1:
    if p in d:
      print("setwise coprime")
      sys.exit()
    d[p] = 1
    p = int(p/b[p])
#pairwise coprimeではない
print("pairwise coprime")
n = input()
inf = 1000000000
M = [[inf for i in range(n)] for i in range(n)]
for i in range(n):
  str = map(int, raw_input().split())
  u = str[0]
  k = str[1]
  for j in range(k):
    v = str[2+n]
    c = str[3+n]
    M[u][v] = c
d = [inf for i in range(n)]
color = [0 for i in range(n)]
 
d[0] = 0
color[0] = 1
 
while 1:
  minv = inf
  u = -1
  for i in range(n):
    if minv>d[i] and color[i]!=2:
      u = i
      minv = d[i]
    print minv
  if u == -1:
    break
  color[u] = 2
  for v in range(n):
    if color[v]!=2 and M[u][v]!=inf:
      if d[v]>d[u]+M[u][v]:
        d[v] = d[u] + M[u][v]
        color[v] = 1
for i in range(n):
  if d[i]==inf:
    print '%d -1' % i
  else:
    print '%d %d' % (i, d[i])

### FIXED CODE ###

n = input()
inf = 1000000000
M = [[inf for i in range(n)] for i in range(n)]
for i in range(n):
  str = map(int, raw_input().split())
  u = str[0]
  k = str[1]
  for j in range(k):
    v = str[2+2*j]
    c = str[3+2*j]
    M[u][v] = c
d = [inf for i in range(n)]
color = [0 for i in range(n)]
 
d[0] = 0
color[0] = 1
 
while 1:
  minv = inf
  u = -1
  for i in range(n):
    if minv>d[i] and color[i]!=2:
      u = i
      minv = d[i]
  if u == -1:
    break
  color[u] = 2
  for v in range(n):
    if color[v]!=2 and M[u][v]!=inf:
      if d[v]>d[u]+M[u][v]:
        d[v] = d[u] + M[u][v]
        color[v] = 1
for i in range(n):
  if d[i]==inf:
    print '%d -1' % i
  else:
    print '%d %d' % (i, d[i])
N, K = map(int, input().split())
h = list(int(input()) for i in range(N))

h.sort()
ans = float('inf')

for i in range(N - K + 1):
  temp = h[i + N - K] - h[i]
  if temp < ans:
    ans = temp

print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
h = list(int(input()) for i in range(N))

h.sort()
ans = float('inf')

for i in range(N - K + 1):
  temp = h[i + K - 1] - h[i]
  if temp < ans:
    ans = temp

print(ans)
import bisect

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

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

a = [0]
b = [0]
for i in range(N):
    a += (a[i] + A[i])
for i in range(M):
    b += (b[i] + B[i])

ans = 0
for i in range(N+1):
    ans = max(ans, i + bisect.bisect_right(b, K - a[i]))

print(ans)

### FIXED CODE ###

import bisect

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

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

a = [0]
b = [0]
for i in range(N):
    a += [a[i] + A[i]]
for i in range(M):
    b += [b[i] + B[i]]

ans = 0
for i in range(N+1):
    if a[i] <= K:
        ans = max(ans, i + bisect.bisect_right(b, K - a[i])-1)

print(ans)
# coding: utf-8
# hello worldと表示する
import sys
import numpy
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

a,b,c,d,e,f=MI()
wasser=[]
g=f//100
for i in range(int(f/a)+1):
    for j in range(int(f/a)+1):
        if a*i+b*j<=f//100:
            wasser.append(100*(a*i+b*j))
water=list(set(wasser))
water.sort()
#print(water)
sugar=[]
for x in water:
    sugar.append((min(f-x,e*x//100)))
#print(sugar)
sugmx=[]
for s in sugar:
    mx=0
    for i in range(s//c+1):
        for j in range(s//c+1):
            if mx<=c*i+d*j<=s:
                mx=c*i+d*j
    sugmx.append(mx)
#print(sugmx)
mix=-inf
for i in range(1,len(water)):
    u=sugmx[i]/water[i]
    #print(u)
    if u>=mix:
        mix=u
        ans1=sugmx[i]
        ans2=water[i]
print(ans2+ans1,ans1)

    

    



        
    



### FIXED CODE ###

# coding: utf-8
# hello worldと表示する
import sys
import numpy
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

a,b,c,d,e,f=MI()
wasser=[]
g=f//100
for i in range(int(f/a)+1):
    for j in range(int(f/a)+1):
        if a*i+b*j<=f//100:
            wasser.append(100*(a*i+b*j))
water=list(set(wasser))
water.sort()
#print(water)
sugar=[]
for x in water:
    sugar.append((min(f-x,e*x//100)))
#print(sugar)
sugmx=[]
for s in sugar:
    mx=0
    for i in range(s//c+1):
        for j in range(s//c+1):
            if mx<=c*i+d*j<=s:
                mx=c*i+d*j
    sugmx.append(mx)
#print(sugmx)
mix=-inf
for i in range(1,len(water)):
    u=sugmx[i]/water[i]
    #print(u)
    if u>=mix:
        mix=u
        ans1=sugmx[i]
        ans2=water[i]
print(ans2+ans1,ans1)
while 1:
        H,W = map(int, raw_input()
        if H == W == 0:
                break
        for i in range(H):
                if i % 2 == 0:
                        if W % 2 == 0:
                                print "#." * (W / 2)
                        else:
                                print "#." * (W / 2) + "#"                       
                else:
                        if W % 2 == 0:
                                print ".#" * (W / 2)
                        else:
                                print ".#" * (W / 2) +"."

### FIXED CODE ###

while 1:
        H,W = map(int, raw_input().split())
        if H + W == 0:
                break
        for i in range(H):
                if i % 2 == 0:
                        if W % 2 == 0:
                                print "#." * (W / 2)
                        else:
                                print "#." * (W / 2) + "#"                       
                else:
                        if W % 2 == 0:
                                print ".#" * (W / 2)
                        else:
                                print ".#" * (W / 2) +"."
        print ""
count=0
for i in range(N):
    if S[i]=="R":
        count+=1
    else:
        ans[i-1] += (count+1)//2
        ans[i] += count//2
        count=0

count=0
for i in range(1,N):
    if S[N-i]=="L":
        count+=1
    else:
        ans[N-i] += count//2
        ans[N-i-1] += (count+1)//2
        count=0

[print(x) for x in ans]

### FIXED CODE ###

S = input()
N = len(S)
ans=[0]*N


count=0
for i in range(N):
    if S[i]=="R":
        count+=1
    else:
        ans[i-1] += (count+1)//2
        ans[i] += count//2
        count=0

count=0
for i in range(1,N+1):
    if S[N-i]=="L":
        count+=1
    else:
        ans[N-i] += count//2
        ans[N-i+1] += (count+1)//2
        count=0

[print(x) for x in ans]
import heapq

# input
N = int(input())
A = [int(x) for x in input().split()]

# Common divisor
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y) #再帰定義

CD = []
for i in A[1:]:
    if A[0] >= i:
        CD.append(gcd(A[0], i))
    else:
        CD.append(gcd(i, A[0]))


print(min(heapq.nlargest(2, CD)))

### FIXED CODE ###

from math import floor

# input process
inputData = input().split()
# A秒後
A = int(inputData[0])
# B枚ずつ
B = int(inputData[1])
# T+0.5秒後まで
T = int(inputData[2])

# calculation process
prodCount = int(floor((float(T) + 0.5) // float(A)))
biscuitTotal = prodCount * B

# output process
print(biscuitTotal)
N = int(input())
p = list(map(int, input().split()))
plen = len(p)

count = 0
for i in range(1, plen):
    if p[i] == i :
        if p[i] == N:
            p[i -1], p[i] = p[i], p[i - 1]
            count += 1
            break
        else:
            p[i], p[i + 1] = p[i + 1], p[i]
            count += 1
print(count)


### FIXED CODE ###

N = int(input())
p = list(map(int, input().split()))
plen = len(p)

count = 0

for i in range(plen):
    if p[i] == i + 1:
        if p[i] == N:
            p[i - 1], p[i] = p[i], p[i - 1]
        else:
            p[i], p[i + 1] = p[i + 1], p[i]
        count += 1
    
            
print(count)
n,a,b = map(int,input())
c = a + b
ans = n/(a+b) + min(n%c,b)

print(ans)

### FIXED CODE ###

n,a,b = map(int,input().split())
c = a + b
ans = n//c*a + min(n%c,a)

print(ans)
R, C, K = map(int, input().split())
# print(R,C,K)

# vis = [[False]*C for _ in range(R)]
mesh = [[0]*C for _ in range(R)]

for _ in range(K):
    r, c, v = map(int, input().split())
    mesh[r-1][c-1] = v

# print(vis)
# print(*mesh,sep='\n')

def dfs(i, j, rows):
    # print('i {} j {} rows {}'.format(i,j,rows))
    # print('i {} j {}'.format(i,j))
    # print(*rows,sep='\n')

    v = 0
    if i == R-1 and j == C-1:
        rows[i].append(mesh[i][j])
        # print('rows {}'.format(rows))
        import heapq
        for row in rows:
            r = []
            for x in row:
                heapq.heappush(r, -x)
            if len(r): v += -heapq.heappop(r)
            if len(r): v += -heapq.heappop(r)
            if len(r): v += -heapq.heappop(r)
        rows[i].pop()
        return v
    if i == R or j == C: return v
    # if vis[i][j]: return v
    # vis[i][j] = True
    rows[i].append(mesh[i][j])
    if j+1 < C: v = dfs(i,   j+1, rows)
    if i+1 < R: v = max(v, dfs(i+1, j  , rows))
    rows[i].pop()
    return v

ans = dfs(0, 0, [[] for _ in range(R)])
print(ans)


### FIXED CODE ###

R, C, K = map(int, input().split())

V = [[0]*(C+1) for _ in range(R+1)]
for _ in range(K):
    r, c, v = map(int, input().split())
    V[r][c] = v

pre = [[0]*(3+1) for _ in range(C+1)]
for i in range(R+1):
    now = [[0]*(3+1) for _ in range(C+1)]
    for j in range(C+1):
        for k in range(3+1):
            if i-1 >= 0:
                now[j][0] = max(now[j][0], pre[j][k])
                now[j][1] = max(now[j][1], pre[j][k] + V[i][j])

            if j-1 >= 0:
                now[j][k] = max(now[j][k], now[j-1][k])
                if k-1 >= 0:
                    now[j][k] = max(now[j][k], now[j-1][k-1] + V[i][j])
    pre = now

print(max(now[C]))
N, D = map(int, input().split())
count = 0

for i in range(N):
  x, y = map(int, input().split())
  d = sqrt(x**2 + y**2)
  
  if d<=D:
    count += 1
    
print(count)

### FIXED CODE ###

import math

N, D = map(int, input().split())
count = 0

for i in range(N):
  x, y = map(int, input().split())
  d = math.sqrt(x**2 + y**2)
  
  if d<=D:
    count += 1
    
print(count)
H, W = map(int, input().split())
m = [list(map(int, input().split())) for _ in range(H)]
visited = [[True]*(W+2)] + [[True]+[False]*W+[True] for _ in range(H)] + [[Tr
ue]*(W+2)]

dirs = [
  (1, 0),
  (0, 1),
  (-1, 0),
  (0, -1)
]
direction = 0
x, y = 1, 1
carry = 0
ans = []
while not visited[y][x]:
  visited[y][x] = True
  m[y-1][x-1] += carry
  if carry:
    ans[-1] += [y, x]

  carry = m[y-1][x-1] % 2
  if carry:
    ans.append([y, x])
    m[y-1][x-1] -= 1 # 別にいらない

  # 今の向きに進めないなら右に曲がる
  nx, ny = x + dirs[direction][0], y + dirs[direction][1]
  if visited[ny][nx]:
    direction = (direction + 1) % 4
  x += dirs[direction][0]
  y += dirs[direction][1]

if len(ans[-1]) < 4:
  y, x = ans.pop()
  m[y-1][x-1] += 1 # もどす

print(len(ans))
for a in ans:
  print(' '.join(list(map(str, a))))

### FIXED CODE ###

H, W = map(int, input().split())
m = [list(map(int, input().split())) for _ in range(H)]
visited = [[True]*(W+2)] + [[True]+[False]*W+[True] for _ in range(H)] + [[True]*(W+2)]

dirs = [
  (1, 0),
  (0, 1),
  (-1, 0),
  (0, -1)
]
direction = 0
x, y = 1, 1
carry = 0
ans = []
while not visited[y][x]:
  visited[y][x] = True
  m[y-1][x-1] += carry
  if carry:
    ans[-1] += [y, x]

  carry = m[y-1][x-1] % 2
  if carry:
    ans.append([y, x])
    m[y-1][x-1] -= 1 # 別にいらない

  # 今の向きに進めないなら右に曲がる
  nx, ny = x + dirs[direction][0], y + dirs[direction][1]
  if visited[ny][nx]:
    direction = (direction + 1) % 4
  x += dirs[direction][0]
  y += dirs[direction][1]

if len(ans) > 0 and len(ans[-1]) < 4:
  y, x = ans.pop()
  m[y-1][x-1] += 1 # もどす

print(len(ans))
for a in ans:
  print(' '.join(list(map(str, a))))