Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

S = list(input())

ans = 0
while True:
    tmp = 0
    for i in range(len(S)-1):
        if S[i] == "B" and S[i+1] == "W":
            S[i] = "W"
            S[i+1] = "B"
            tmp += 1
    if not tmp:
        break
    ans += tmp
        
print(ans)

### FIXED CODE ###

S = input()

ans = 0
cnt = 0
for i in range(len(S)):
    if S[i] == "W":
        ans += i-cnt
        cnt += 1
        
print(ans)
### BUGGY CODE ###

num = input()
N, M = [int(x) for x in num.split()]

A = []
B = []
for n in range(N):
    num = input()
    a, b = [int(x) for x in num.split()]
    A.append(a)
    B.append(b)

count = 0
money = 0
while count < M:
    ind = A.index(min(A))

    if (M - count) > B[ind]:
        money += A[ind] * B[ind]
        count += B[ind]
    else:
        money += A[ind] * (M - count)
        count += B[ind]

    A.remove(min(A))
    B.pop(ind)

print(money)


### FIXED CODE ###

num = input()
N, M = [int(x) for x in num.split()]

dic = []
for n in range(N):
    num = input()
    a, b = [int(x) for x in num.split()]
    dic.append((a, b))

sort = sorted(dic, key=lambda x: x[0])
count = 0
money = 0
ind = 0
while count < M:

    if (M - count) > sort[ind][1]:
        money += sort[ind][0] * sort[ind][1]
        count += sort[ind][1]
    else:
        money += sort[ind][0] * (M - count)
        count += (M - count)

    ind += 1
print(money)
### BUGGY CODE ###

import math

N = int(input())
a = math.factorial(N)
ans = 0

for i in range(1, a+1):
    if a%i == 0:
        ans += 1
        ans %= 10**9+7
print(ans%(10**9+7))

### FIXED CODE ###

import math
import collections

N = int(input())
a = math.factorial(N)
check = []
ans = 1
i = 2

while a != 1:
    if a % i == 0:
        a //= i
        check.append(i)
    else:
        i += 1
        
check = collections.Counter(check).values()
for i in check:
    ans *= (i+1)
    ans %= 10**9+7
print(ans)
### BUGGY CODE ###

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

hdic = {}
wdic = {}
hws_h = {}

for m in range(M):
    h, w = map(int, input().split())
    if h in hdic.keys():
        hdic[h] += 1
        hws_h[h].append(w)
    else:
        hdic[h] = 1
        hws_h[h] = [w]
    
    if w in wdic.keys():
        wdic[w] += 1
    else:
        wdic[w] = 1

hmax = max(hdic.values())
wmax = max(wdic.values())

hs = []
ws = []

hs = [k for k, v in hdic.items() if v==hmax]
ws = [k for k, v in wdic.items() if v==wmax]

f = 1
for h in hs:
    wlist = hws_h[h]
    for w in ws:
        if w not in wlist:
            f = 0
            break
    if f == 0:
        break

print(hmax + wmax - f)


### FIXED CODE ###

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

hdic = {}
wdic = {}
hws_h = {}
hws_w = {}

for m in range(M):
    h, w = map(int, input().split())
    if h in hdic.keys():
        hdic[h] += 1
        hws_h[h].append(w)
    else:
        hdic[h] = 1
        hws_h[h] = [w]
    
    if w in wdic.keys():
        wdic[w] += 1
        hws_w[w].append(h)
    else:
        wdic[w] = 1
        hws_w[w] = [h]

hmax = max(hdic.values())
wmax = max(wdic.values())

hs = []
ws = []

hs = [k for k, v in hdic.items() if v==hmax]
ws = [k for k, v in wdic.items() if v==wmax]

f = 1

if len(ws) < len(hs):
    for h in hs:
        wlist = hws_h[h]
        for w in ws:
            if w not in wlist:
                f = 0
                break
        if f == 0:
            break
        
else:
    for w in ws:
        hlist = hws_w[w]
        for h in hs:
            if h not in hlist:
                f = 0
                break
        if f == 0:
            break

print(hmax + wmax - f)
### BUGGY CODE ###

N=int(input())
An=list(map(int,input().split()))
mod=10**9+7
S=0
for i in range(N):
    for j in range(N):
        if i<j:
            S += An[i]*An[j]
print(S%mod)


### FIXED CODE ###

N=int(input())
An=list(map(int,input().split()))
mod=10**9+7
s=sum(An)
S=0
num = 0
for i in range(N):
    num += An[i]
    S += (An[i]*(s-num))
print(S%mod)
### BUGGY CODE ###

"""
    リーダーに向いてない人の最小
    (W in 0~i) + (E in i+2~n-1)
"""
from collections import Counter as count
n = int(input())
s = input()
least = n

for i in range(n):
    turn = count(s[:i])['W'] + count(s[i+2:])['E']
    if turn < least:
        least = turn

print(least)


### FIXED CODE ###

"""
    リーダーに向いてない人の最小
    (W in 0~i) + (E in i+2~n-1)
"""
from collections import Counter as count
n = int(input())
s = input()
turn = count(s[1:])['E']
least = turn

for i in range(n-1):
    if s[i] == 'W':
        turn += 1
    if s[i+1] == 'E':
        turn -= 1
    if turn < least:
        least = turn

print(least)
### BUGGY CODE ###

from collections import deque
import bisect
from copy import copy

n = int(input())
a = list(map(int, input().split()))
to=[list() for _ in range(n)]

for i in range(n-1):
    u,v = map(int, input().split())
    u-=1
    v-=1
    to[u].append(v)
    to[v].append(u)

d= deque()
INF=10010001001
dpinit = [a[0]]
d.append((0,-1,copy(dpinit)))
ansls=[0]*n
ansls[0]=1
while d:
    u,p,dp = d.popleft()
    for v in to[u]:
        if v==p:
            continue
        dp2=copy(dp)
        idx=bisect.bisect_left(dp2,a[v])
        if idx<len(dp2):
            dp2[idx]=a[v]
        else:
            dp2.append(a[v])
        ansls[v]=len(dp2)
        d.append((v,u,copy(dp2)))

print(*ansls,sep='\n')
        










### FIXED CODE ###

from collections import deque
import bisect
import sys
sys.setrecursionlimit(500000)

n = int(input())
a = list(map(int, input().split()))
to=[list() for _ in range(n)]

for i in range(n-1):
    u,v = map(int, input().split())
    u-=1
    v-=1
    to[u].append(v)
    to[v].append(u)

INF=1001001001
dp = [INF]*n
dp[0]=a[0]
ansls=[0]*n
ansls[0]=1
history=deque()
def dfs(u,p,rank):
    for v in to[u]:
        if v==p:
            continue
        idx=bisect.bisect_left(dp,a[v])
        prv=dp[idx]
        dp[idx]=a[v]       
        history.append((idx,prv))
        ansls[v]=bisect.bisect_left(dp,INF)
        dfs(v,u,rank+1)
        while len(history)>rank:
            idx,prv =history.pop()
            dp[idx] = prv

dfs(0,-1,0)

print(*ansls,sep='\n')
### BUGGY CODE ###

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

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

for i in range(M) :
    l,r,d = map(int,input().split())
    l -= 1
    r -= 1
    
    A[l].append([r,d])
    A[r].append([l,-d])

dist = [False for i in range(N)]

ans = "Yes"

flg = 0

for i in range(N) :
    if flg :
        break
    
    if dist[i] :
        continue
    
    dist[i] = 0
    
    q = [i]
    
    while q :
        now = q.pop()
        for to,d in A[now] :
            if not dist[to] :
                dist[to] = dist[now] + d
                q.append(to)
            
            elif dist[to] == dist[now] + d :
                continue
            
            else :
                ans = "No"
                flg = 1
                q = []
                break

print(ans)


### FIXED CODE ###

N,M = map(int,input().split())
A = [[] for i in range(N+1)]

for i in range(M) :
    l,r,d = map(int,input().split())
    
    l -= 1
    r -= 1
    
    A[l].append([r,d])
    A[r].append([l,-d])

distance = ["#" for i in range(N)]

ans = "Yes"

flg = 0

for i in range(N) :
    if flg == 1 :
        break
    
    if distance[i] != "#" :
        continue
    
    distance[i] = 0
    stack = [i]
    
    while stack :
        v = stack.pop()
        
        for to,d in A[v] :
            if distance[to] == "#" :
                distance[to] = distance[v] + d
                stack.append(to)
            
            elif distance[to] != distance[v] + d :
                ans = "No"
                stack = []
                flg = 1
                break
                

print(ans)
### BUGGY CODE ###

n = int(input())
L = list(map(int,input().split()))
L = sorted(L,reverse=True)
total = 0
for i in range(0,n-2):
    for j in range(i+1,n-1):
        if L[j] > L[i]/2:
            for k in range(j+1,n):
                if L[j] + L[k] > L[i]:
                    total += 1
                else:
                    break
        else:
            break
print(total)


### FIXED CODE ###

import bisect

n = int(input())
L = list(map(int,input().split()))
L = sorted(L)
ans = 0

for i in range(n-1):
    for j in range(i+1,n):
        limit = L[i]+L[j]
        ans += bisect.bisect_left(L,limit) - (j+1)

print(ans)
### BUGGY CODE ###

import math
N = int(input())
A = list(map(int, input().split()))
def factorize(n):
    i = 2
    factors = set()
    while i**2 <= n:
        if n % i != 0:
            i += 1
            continue

        while n % i == 0:
            n = n // i
            factors.add(i)
        i += 1

    if n != 1:
        factors.add(n)

    return factors

isSetWise = False
gcd = A[0]
for i in range(1, N):
    gcd = math.gcd(gcd, A[i])
if gcd == 1:
    isSetWise = True

isPairWise = True
g = factorize(A[0])
for i in range(1, N):
    f = factorize(A[i])

    if not g.isdisjoint(f):
        isPairWise = False
        break
    g = g | f

if isPairWise:
    print("pairwise coprime")
    exit()

if isSetWise:
    print("setwise coprime")
    exit()

print("not coprime")


### FIXED CODE ###

class Sieve:
    """
    N以下の素数を列挙するエラトステネスのふるいです。
    O(NloglogN)でできます。

    Attributes
    sieveList : その数の素因数のうち最小のものの配列
    primes : N以下の素因数のリスト
    """
    def __init__(self, N):
        self.sieveList = [-1 for _ in range(N+1)]
        self.sieveList[1] = 1
        self.primes = []

        for i in range(2, N+1):
            #すでに何らかの数で割られていたらcontinue
            if self.sieveList[i] != -1:
                continue
            self.primes.append(i)
            for j in range(i, N+1, i):
                if self.sieveList[j] != -1:
                    continue
                self.sieveList[j] = i

    def getPrimes(self):
        return self.primes

    def getSieveList(self):
        return self.sieveList

class FastFactorization(Sieve):
    """
    高速素因数分解です。
    与えられたL個の数がA以下の時、
    エラトステネスでO(AloglogA)＋素因数分解でO(LlogA) = O(AloglogA+NlogA)でできます。
    """

    def __init__(self, N):
        """
        前処理でスーパークラスのエラトステネスを使ってN以下の素因数を列挙します。
        """
        super().__init__(N)
        self.N = N
        self.sieveList = self.getSieveList()

    def factorize(self, x):
        if x > self.N:
            raise ValueError("与えられた数がエラトステネスのリストの上限を超えている")
        p = set()
        # p = []
        while x > 1:
            divisor = self.sieveList[x]
            x //= divisor
            p.add(divisor)
            # p.append(divisor)
        return p

import math
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))

#is setwise?
gcd = A[0]
for i in range(1, N):
    gcd = math.gcd(gcd, A[i])
isSetwise = (gcd == 1)

#is pairwise?
maxNum = max(A)
factorizor = FastFactorization(maxNum)
factors = defaultdict(int)
isPairwise = True
for i in range(N):
    p = factorizor.factorize(A[i])
    for x in p:
        if factors[x]:
            isPairwise = False
            break
        else:
            factors[x] = 1

if isPairwise:
    print("pairwise coprime")
elif isSetwise:
    print("setwise coprime")
else:
    print("not coprime")
### BUGGY CODE ###

#!/usr/bin/env python3
# vim: set fileencoding=utf-8

# pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation


"""Module docstring
"""

import sys


def solve(s, t):
    v = [0 for _ in range(len(s) + 1)]
    dp = [v]
    for i, ti in enumerate(t):
        u, v = v, v.copy()
        dp.append(v)
        for j, sj in enumerate(s):
            if sj == ti:
                v[j + 1] = 1 + u[j]
            else:
                v[j + 1] = max(u[j + 1], v[j])
    i = len(t)
    j = len(s)
    k = dp[i][j]
    selected = []
    while k > 0:
        if t[i - 1] == s[j - 1]:
            selected.append(t[i - 1])
            k -= 1
            i -= 1
            j -= 1
        elif dp[i - 1][j] > dp[i][j - 1]:
            i -= 1
        else:
            j -= 1
    return "".join(selected[::-1])


def do_job():
    "Do the work"
    s = input()
    t = input()
    result = solve(s, t)
    print(result)


def print_output(testcase, result) -> None:
    "Formats and print result"
    if result is None:
        result = "IMPOSSIBLE"
    print("Case #{}: {}".format(testcase + 1, result))


def main(argv=None):
    "Program wrapper."
    if argv is None:
        argv = sys.argv[1:]
    do_job()
    return 0


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    sys.exit(main())


### FIXED CODE ###

#!/usr/bin/env python3
# vim: set fileencoding=utf-8

# pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation


"""Module docstring
"""

import sys


def solve(s, t):
    v = [0] * (len(s) + 1)
    dp = [v]
    for _, ti in enumerate(t, 1):
        u, v = v, v.copy()
        dp.append(v)
        ll, ul = 0, 0
        for j, sj in enumerate(s, 1):
            uj = u[j]
            if sj == ti:
                v[j] = 1 + ul
                ll = 1 + ul
            else:
                if ll > uj:
                    v[j] = ll
                else:
                    ll = uj
            ul = uj
    i = len(t)
    j = len(s)
    k = dp[i][j]
    selected = []
    while k > 0:
        if dp[i - 1][j] == k:
            i -= 1
        elif dp[i][j - 1] == k:
            j -= 1
        else:
            selected.append(t[i - 1])
            k -= 1
            i -= 1
            j -= 1
    return "".join(selected[::-1])


def do_job():
    "Do the work"
    s = input()
    t = input()
    result = solve(s, t)
    print(result)


def print_output(testcase, result) -> None:
    "Formats and print result"
    if result is None:
        result = "IMPOSSIBLE"
    print("Case #{}: {}".format(testcase + 1, result))


def main(argv=None):
    "Program wrapper."
    if argv is None:
        argv = sys.argv[1:]
    do_job()
    return 0


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    sys.exit(main())
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
q=0
for i in range(0,n):
    p=0
    for j in range(i,n-1):
        if a[j]>=a[j+1]:
          p+=1
        else:
            break
    if p>q:
        q=p
print(q)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
i=0
p=q=0
for i in range(n-1):
  if a[i]>=a[i+1]:
    p+=1
  else:
    q=max(p,q)
    p=0
q=max(p,q)
print(q)
### BUGGY CODE ###

#それゆけにぶたんまん
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n):
    for j in range(i+1,n):
        #jより大きい整数kでl[k]<l[i]+l[j]を満たす最大のk
        le = j
        ri = n
        while ri-le>1:
            m = (ri+le)//2
            if l[m]<l[i]+l[j]:
                le = m
            else:
                ri = m
        ans += le-j

print(ans)


### FIXED CODE ###

#それゆけにぶたんまん
#python3.8.2のTLEの壁に阻まれました
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n):
    for j in range(i+1,n):
        #jより大きい整数kでl[k]<l[i]+l[j]を満たす最大のk
        le = j
        ri = n
        while ri-le>1:
            m = (ri+le)//2
            if l[m]<l[i]+l[j]:
                le = m
            else:
                ri = m
        ans += le-j

print(ans)
### BUGGY CODE ###

#!/usr/bin/python3

import sys
import resource
import bisect
from collections import defaultdict

sys.setrecursionlimit(1000000)
#resource.setrlimit(resource.RLIMIT_STACK, (-1, -1))


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

nbs = defaultdict(list)

for i in range(n - 1):
    (u, v) = map(int, input().split())
    nbs[u - 1].append(v - 1)
    nbs[v - 1].append(u - 1)


mlen =  [ 0 ] * n
dp = [ float('inf') ] * n

def getmlen(cur, p, ctail):
    ca = a[cur]

    oidx = 0
    ov = 0
    
    idx = bisect.bisect_left(dp, ca)
    ov = dp[idx]

    ntail = ctail
    if ctail < idx:
        ntail = idx

    dp[idx] = ca
    mlen[cur] = ntail + 1
    
    for ch in nbs[cur]:
        if ch == p:
            continue

        getmlen(ch, cur, ntail)

    dp[idx] = ov
    return



getmlen(0, -1, 0)

for i in range(n):
    print(mlen[i])


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
from bisect import bisect_left
 
N = int(input())
a = [int(i) for i in input().split()]
vec = [[] for _ in range(N)]
for _ in range(N - 1) :
  u, v = map(int, input().split())
  vec[u - 1].append(v - 1)
  vec[v - 1].append(u - 1)
 
lis = [a[0]]
ret = [0] * N
def dfs(cur, pre) :
  for nex in vec[cur] :
    if nex == pre : continue
    if a[nex] > lis[-1] :
      lis.append(a[nex])
      ret[nex] = len(lis)
      dfs(nex, cur)
      lis.pop()
    else :
      pos = bisect_left(lis, a[nex])
      v = lis[pos]
      lis[pos] = a[nex]
      ret[nex] = len(lis)
      dfs(nex, cur)
      lis[pos] = v
 
dfs(0, -1)
 
ret[0] = 1
for i in range(N) :
  print(ret[i])
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
if n % 2:
    if a.count(0) != 1:
        print(0)
        exit()
    for i in range(2, n, 2):
        if a.count(i) != 2:
            print(0)
            exit()
else:
    if a.count(1) != 2:
        print(0)
        exit()
    for i in range(1, n, 2):
        if i == 1:
            continue
        if a.count(i) != 2:
            print(0)
            exit()
print(2 ** (n // 2))

### FIXED CODE ###

import collections

n = int(input())
a = list(map(int, input().split()))
ac = collections.Counter(a)
if n % 2 == 1:
    for i in ac:
        if i == 0:
            if ac[i] != 1:
                print(0)
                exit()
        else:
            if ac[i] != 2:
                print(0)
                exit()
    print((2 ** (n // 2)) % (10 ** 9 + 7))
else:
    for i in ac:
        if i == 0:
            if ac[i] != 0:
                print(0)
                exit()
        else:
            if ac[i] != 2:
                print(0)
                exit()
    print((2 ** (n // 2)) % (10 ** 9 + 7))
### BUGGY CODE ###

import numpy as np
N,K=map(int,input().split())
p=list(map(int,input().split()))
mx = 0
p=np.array(list(map(lambda x: (1+x)/2, p)))
#print(p)
for i in range(N-K+1):
  s = np.sum(p[i:i+K])
  #print(s)
  mx = max(s,mx)
  
print(mx)

### FIXED CODE ###

import numpy as np
N,K=map(int,input().split())
p=list(map(int,input().split()))
p=np.array(list(map(lambda x: (1+x)/2, p)))
mx_0 = np.sum(p[:K])
mx=0
#print(p)
if N!=K:
  for i in range(1,N-K+1):
    s = mx_0-p[i-1]+p[i+K-1]
    mx_0=s
    #print(s)
    mx = max(s,mx)
else:
  mx=np.sum(p)
  
print(mx)
### BUGGY CODE ###

a,b,x=map(int,input().split())
ans=0
for i in range(a,b+1):
  if i%x==0:
    ans+=1
print(ans)

### FIXED CODE ###

a,b,x=map(int,input().split())
#TLE#########################
# ans=0
# for i in range(a,b+1):
#   if i%x==0:
#     ans+=1
# print(ans)
################################
print(b//x - (a-1)//x)
### BUGGY CODE ###

Q = int(input())
point=[]
query=[]
for i in range(Q):
    l,r=[int(i) for i in input().split()]
    point.append(l)
    point.append(r)
    query.append([l,r])
# print(point)
point_uniq = list(set(point))
# print(point_uniq)
point_sorted = sorted(point_uniq)
# print(point_sorted)

#ふるい
SIZE=100001
is_prime=[True for i in range(SIZE)]
is_prime[0]=False
is_prime[1]=False
for i in range(2,SIZE):
    # print(i,is_prime)
    if is_prime[i]==False:
        continue
    else:
        tmp=i+i
        while(tmp<SIZE):
            is_prime[tmp]=False
            tmp+=i

MIN=point_sorted[0]
MAX=point_sorted[-1]
N_count=0
index=1
range_N=[]
for i in range(MIN,MAX+1):
    if i%2==0:
        continue
    if is_prime[i]==True and is_prime[int((i+1)/2)]==True:
        N_count+=1
    if i==point_sorted[index]:
        index+=1
        range_N.append([MIN,i,N_count])
# print(range_N)

for q in query:
    ans=0
    l_index=point_sorted.index(q[0])
    r_index=point_sorted.index(q[1])
    # print(q,l_index,r_index)
    if l_index==r_index:
        ans=1 if is_prime[q[0]] and is_prime[int((q[0]+1)/2)] else 0
    elif l_index==0:
        ans=range_N[r_index-1][2]
    else:
        ans=range_N[r_index-1][2]-range_N[l_index-1][2]
        if is_prime[q[0]] and is_prime[int((q[0]+1)/2)]:
            ans+=1
    print(ans)


### FIXED CODE ###

Q = int(input())
point=[]
query=[]
for i in range(Q):
    l,r=[int(i) for i in input().split()]
    point.append(l)
    point.append(r)
    query.append([l,r])
# print(point)
point_uniq = list(set(point))
# print(point_uniq)
point_sorted = sorted(point_uniq)
# print(point_sorted)

def binary_search(list,target):

	result = -1
	left = 0
	right = len(list) - 1

	while left <= right:
		center = (left + right)//2
		if list[center] == target:
			result = center
			break
		elif list[center] < target:
			left = center + 1
		elif list[center] > target:
			right = center - 1

	return result


#ふるい
SIZE=100001
is_prime=[True for i in range(SIZE)]
is_prime[0]=False
is_prime[1]=False
for i in range(2,SIZE):
    # print(i,is_prime)
    if is_prime[i]==False:
        continue
    else:
        tmp=i+i
        while(tmp<SIZE):
            is_prime[tmp]=False
            tmp+=i

MIN=point_sorted[0]
MAX=point_sorted[-1]
N_count=0
index=1
range_N=[]
for i in range(MIN,MAX+1):
    if i%2==0:
        continue
    if is_prime[i]==True and is_prime[int((i+1)/2)]==True:
        N_count+=1
    if i==point_sorted[index]:
        index+=1
        range_N.append([MIN,i,N_count])
# print(range_N)

for q in query:
    ans=0
    l_index=binary_search(point_sorted,q[0])
    r_index=binary_search(point_sorted,q[1])

    # l_index=point_sorted.index(q[0])
    # r_index=point_sorted.index(q[1])
    # print(q,l_index,r_index)
    if l_index==r_index:
        ans=1 if is_prime[q[0]] and is_prime[int((q[0]+1)/2)] else 0
    elif l_index==0:
        ans=range_N[r_index-1][2]
    else:
        ans=range_N[r_index-1][2]-range_N[l_index-1][2]
        if is_prime[q[0]] and is_prime[int((q[0]+1)/2)]:
            ans+=1
    print(ans)
### BUGGY CODE ###

a,b,c,d = input().split(" ")
a = int(a)
b = int(b)
c = int(c)
d = int(d)

s = []

for x in range(a,b+1):
  for y in range(c,d+1):
    n = x*y
    s.append(n)

s.sort(reverse = True)
print(s[0])

### FIXED CODE ###

a = input().split(" ")

x = [int(a[0]),int(a[1])]
y = [int(a[2]),int(a[3])]

ans = []

for i in x:
  for j in y:
    s = i*j
    
    ans.append(s)
ans.sort(reverse = True)  
print(ans[0])