Harryxun/stf_run huggingface dataset:
import math
A,B,H,M = map(int, input().split())
X = H*30+M*0.5
Y = M*6
if  -180 < X - Y < 0:
  Z = Y - X
elif X - Y <= -180:
  Z = 360 -(Y - X)
elif 180 > X - Y => 0:
  z = X - Y
else:
  Z = 360-(X - Y)
ans = A*A+B*B-2*A*B*math.cos(math.radians(Z))
ANS = ans**0.5

print(ANS)

### FIXED CODE ###

import math
A,B,H,M = map(int, input().split())
X = H*30+M*0.5
Y = M*6
if  -180 < X - Y < 0:
  z = Y - X
elif X - Y <= -180:
  z = 360 -(Y - X)
elif 180 > X - Y >= 0:
  z = X - Y
elif X - Y >= 180:
  z = 360-(X - Y)
ans = A*A+B*B-2*A*B*math.cos(math.radians(z))
ANS = math.sqrt(ans)

print(ANS)
n=int(input())
s=list(map(int,list(input())))
edge=[[]for _ in range(n)]
for _ in range(n-1):
  a,b=map(int,input().split())
  a-=1
  b-=1
  edge[a].append(b)
  edge[b].append(a)
def f(a):
  l,r,c,x=a[0]
  for u,v,d,y in a[1:]:l,r=max(max(l,u)-min(r,v),0)+((l^u)&1),r+v;c+=d;x+=y
  return [l,r,c,x]
def dfs(root,node):
  lrcx=[]
  for mode in edge[node]:
    if root!=mode:
      lrcx.append(dfs(node,mode))
  if len(lrcx)==0:
    return [s[node]]*4
  l,r,c,x=f(lrcx)
  c+=s[node]
  return [l+c,r+c,c,x+c]
anss=[]
for i in range(n):
  l,r,c,x=dfs(-1,i)
  if l==c:
    anss.append(x-c)
if len(anss)==0:print(-1)
else:print(min(anss)//2)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
n=int(input())
s=list(map(int,list(input()[:-1])))
edge=[[]for _ in range(n)]
for _ in range(n-1):
  a,b=map(int,input().split())
  a-=1
  b-=1
  edge[a].append(b)
  edge[b].append(a)
def f(lrc):
  l1,r1,c1,x1=lrc[0]
  for l2,r2,c2,x2 in lrc[1:]:
    l1,r1=max(max(l1,l2)-min(r1,r2),0),r1+r2
    if r1%2!=l1%2:l1+=1
    c1+=c2
    x1+=x2
  return [l1,r1,c1,x1]
def dfs(root,node):
  lrcx=[]
  for mode in edge[node]:
    if root!=mode:
      lrcx.append(dfs(node,mode))
  if len(lrcx)==0:
    return [s[node]]*4
  l,r,c,x=f(lrcx)
  c+=s[node]
  return [l+c,r+c,c,x+c]
anss=[]
for i in range(n):
  l,r,c,x=dfs(-1,i)
  if l==c:
    anss.append(x-c)
if len(anss)==0:print(-1)
else:print(min(anss)//2)
a,b,c = map(int,input().split())

print(a+b+c)

### FIXED CODE ###

x = str(input())
a =int(x[0])
b=int(x[1])
c=int(x[2])


print(a+b+c)
a = int(input())
b = int(input())
c = int(input())
 
A = a + b+ c
 
if A >= 22:
 print('bust')
  else:
  print('win')

### FIXED CODE ###

a1, a2, a3 = map(int, input().split())
 
if a1 + a2 + a3 >= 22:
  print('bust')
else:
  print('win')
n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  for j in range(a):
    x=[0]*a
    y=[0]*a
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  

c=0
for i in range(n):
  l=[1]*n
  for j in range(i,n-i):
    if l[j]==0:continue
    for k in range(A[j]):
      b=X[j][k]
      #l[b-1]*
      b=Y[j][k]
  if c < l.count(1):
    c=l.count(1) 
  
        
  
print(c)  
   

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[0]*a
  y=[0]*a
  for j in range(a):
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
s=0
for i in range(2**n):
  c=0
  d=0
  B=[0]*n
  for j in range(n):
    if((i >> j) & 1):
      c=c+1
      B[j]=1
  for k in range(n):
    if B[k]==1:
      for j in range(A[k]):
        if Y[k][j]!=B[X[k][j]-1]:
          d=-1
          break
    if d<0:
      break
  if s<c and d==0:
    s=c
      
      
print(s)
from collections import Counter, defaultdict
H, W = map(int, input().split(' '))
d = defaultdict(int)
for i in range(H):
    for k, v in Counter(input()).items():
        d[k] += v
if H % 2 == 0 and W % 2 == 0:
    for i in d.values():
        if i % 4 != 0:
            print('No')
            exit()
    print('Yes')
elif H % 2 == 0 or W % 2 == 0:
    cnt = H//2 if not H % 2 else W//2
    for i in d.values():
        if i % 4 == 0:
            continue
        elif i % 2 == 0:
            cnt -= 1
            if cnt >= 0:
                continue
        print('No')
        exit()
    print('Yes')
else:
    raise TypeError
    odd = 1
    cnt = H+W-1
    for i in d.values():
        if i % 2 != 0 and odd:
            odd -=1
            continue
        elif i % 4 == 0:
            continue
        elif i % 2 == 0 and cnt:
            cnt -= 1
            continue
        else:
            print('No')
            exit()
    print('Yes')

### FIXED CODE ###

from collections import Counter, defaultdict
H, W = map(int, input().split(' '))
d = defaultdict(int)
for i in range(H):
    for k, v in Counter(input()).items():
        d[k] += v
if H % 2 == 0 and W % 2 == 0:
    for i in d.values():
        if i % 4 != 0:
            print('No')
            exit()
    print('Yes')
elif H % 2 == 0 or W % 2 == 0:
    cnt = H//2 if not H % 2 else W//2
    for i in d.values():
        if i % 4 == 0:
            continue
        elif i % 2 == 0:
            cnt -= 1
            if cnt >= 0:
                continue
        print('No')
        exit()
    print('Yes')
else:
    odd = 1
    cnt = (H+W-2)//2
    for i in d.values():
        if i % 2 != 0 and odd:
            odd -= 1
            continue
        elif i % 4 == 0:
            continue
        elif i % 2 == 0 and cnt:
            cnt -= 1
            continue
        else:
            print('No')
            exit()
    print('Yes')
import math

X = int(input())

def decompose(n):
	result = []
	half = math.floor(math.sqrt(n))
	i = 2
	while i <= half:
		if n % i == 0:
			result.append(i)
			n //= i
			half = math.floor(math.sqrt(n))
		else:
			i += 1
	if n > 1:
		result.append(n)
	return result

facts = decompose(X)

fact_table = {}
for f in facts:
	if f not in fact_table:
		fact_table[f] = 1
	else:
		fact_table[f] += 1

facts = list(fact_table.items())
facts.sort()

def find(num, n):
	if n >= len(facts):
#		print(num)
		A = 1
		while True:
			B = A - num
			x = A ** 5 - B ** 5
#			print(">", A, B, x)
			if x == X:
				return A, B
			elif x > X:
				break
			A += 1
	else:
		f, c = facts[n]
		for i in range(c + 1):
			ret = find(num, n + 1)
			if ret != None:
				return ret
			num *= f
	return None

A, B = find(1, 0)


print(A, B)


### FIXED CODE ###

import math

X = int(input())

def decompose(n):
	result = []
	half = math.floor(math.sqrt(n))
	i = 2
	while i <= half:
		if n % i == 0:
			result.append(i)
			n //= i
			half = math.floor(math.sqrt(n))
		else:
			i += 1
	if n > 1:
		result.append(n)
	return result

facts = decompose(X)

fact_table = {}
for f in facts:
	if f not in fact_table:
		fact_table[f] = 1
	else:
		fact_table[f] += 1

facts = list(fact_table.items())
facts.sort()

def bisearch_smallest(f, s, e = None):
	if e == None:
		e = s - 1
		s = 0
	else:
		e -= 1
	
	while s < e:
		m = (s + e) // 2
		if f(m):
			e = m
		else:
			s = m + 1
	
	if s == e and f(s):
		return s
	else:
		return -1

def find(num, n):
	if n >= len(facts):
		m = bisearch_smallest(lambda A: 5 * A ** 4 - 5 * (A - num) ** 4 >= 0, 0, 10 ** 9)
		i = bisearch_smallest(lambda A: A ** 5 - (A - num) ** 5 <= X, 0, m + 1)
		j = bisearch_smallest(lambda A: A ** 5 - (A - num) ** 5 >= X, m - 1, 10 ** 9)
		
		if i ** 5 - (i - num) ** 5 == X:
			return i, i - num
		if j ** 5 - (j - num) ** 5 == X:
			return j, j - num
	else:
		f, c = facts[n]
		for i in range(c + 1):
			ret = find(num, n + 1)
			if ret != None:
				return ret
			num *= f
	return None

A, B = find(1, 0)


print(A, B)
A, B = map(int,input().split())
out = 1 
ans = 0
while out < B:
  out += A
  ans ++
print(ans)

### FIXED CODE ###

A, B = map(int,input().split())
out = 1 
ans = 0

while out < B:
  out += A-1
  ans += 1

print(ans)
W, H, N = map(int, input().split())
X, Y = 0, 0
for i in range(N):
  x, y, a = map(int, input().split())
  if a == 1:
    X = max(x, X)
  elif a == 2:
    W = min(W, x)
  elif a == 3:
    Y = max(y, Y)
  elif a == 4:
    H = min(H, y)
ans = (W-X)*(H-Y)
if ans <= 0:
  print(0)
else:
  print(ans)


### FIXED CODE ###

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

if max(a,b,c) == (a+b+c)-max(a,b,c):
  print("Yes")
else:
  print("No")
import sympy

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

print("Yes" if (sympy.sqrt(a) + sympy.sqrt(b)) < sympy.sqrt(c) else "No")


### FIXED CODE ###

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

if c - a - b > 0 and 4 * a * b < (c - a - b)**2:
    print("Yes")
else:
    print("No")
def main():
    input = input()

    if 0 <= input < 86400:
        hour = input / 3600
        minute = (input // 60) % 60
        seconde = input % 60
        print("{0}:{1}:{2}".format(hour,minute,seconde))

if __name__ == "__main__":
    main()

### FIXED CODE ###

input = int(input())
if 0 <= input < 86400:
    hour = input / 3600
    minute = (input / 60) % 60
    second = input % 60
    print("%d:%d:%d" % (hour,minute,second))
nums = input()
set_nums = list(set(nums))
other = sum(nums) - sum(set_nums)
set_nums.remove(other)
print(set_nums[0])

### FIXED CODE ###

nums = map(int, input().split())
d = {}
for n in nums:
  d.setdefault(n, 0)
  d[n] += 1
print(list(d.keys())[list(d.values()).index(1)])
x=input()
def f(n):
 if n==0:return 1
 return f(n-1)*n
print(f(int(n)))

### FIXED CODE ###

# -*- coding:shift-jis -*-
x=input()
def f(n):
 if n==0:return 1
 return f(n-1)*n
print(f(int(x)))
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N,M,X,Y = inpl()
X = max(inpl(),X)
Y = mrin(inpl(),Y)
if X < Y:
    print("No War")
else:
    print("War")


### FIXED CODE ###

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N,M,X,Y = inpl()
X = max(max(inpl()),X)
Y = min(min(inpl()),Y)
if X < Y:
    print("No War")
else:
    print("War")
N = input()
print(N**3)

### FIXED CODE ###

N = input()
N = int(N)
print(N**3)
import sympy
n=int(input())
ans=0
for i in range(1,n+1):
    ans+=i*sympy.divisor_count(i)
    

print(ans)

### FIXED CODE ###

n=int(input())
ans=0
for i in range(1,n+1):
    m=n//i #　iを約数にもつ数の個数
    j=(1+m)*m//2 
    ans+=j*i
    
print(ans)
D = int(input())
st = 'Chritsmas'
ww = 25-D
print(st+(' Eve'*WW))


### FIXED CODE ###

D = int(input())
st = 'Christmas'
ww = 25-D
ans = st + (' Eve')* ww 
print(ans)
k = int(input())
sum_ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        gcd_ab = gcd(a, b)
        for c in range(1, k+1):
            gcd_abc = gcd(gcd_ab, c)
            sum_ans += gcd_abc
print(sum_ans)

### FIXED CODE ###

import math

k = int(input())
ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        gcd_ab = math.gcd(a, b)
        for c in range(1, k+1):
            ans += math.gcd(gcd_ab, c)
print(ans)
a, b = int(input().split())
print(a*b)




### FIXED CODE ###

a, b = (int(x) for x in input().split())
print(a*b, 2*a + 2*b)
import sys
def f0070(A,n,s):
  if n==1:return s in A
  A=sorted(A)
  A1=A[:n+1][::-1]
  A2=A[-n-1:]
  b1=0
  b2=0
  c=0
  for i in range(1,n+1):
    b1+=i*A1[i]
    b2+=i*A2[i]
  if b1<=s<=b2:
    for i in range(len(A)):
      c+=f0070(A[:i]+A[i+1:],n-1,s-A[i]*n)
  return c
for a in sys.stdin:
  n,s=map(int,a.split())
  print f0070(range(10),n,s)

### FIXED CODE ###

import sys
K=1024
N=331
R=range(K)
B=[1,2,4,8,16,32,64,128,256,512]
C=[0]*K
D=[[0 for i in range(N)]for j in R]

for i in R:
  s=format(i,'b')
  n=s.count('1')
  C[i]=n
  if n==1:D[i][B.index(i)]=1
  else:
    for j in range(len(s)):
      if s[-j-1]=='1':
        dp=n*j
        i2=i-B[j]
        for k in range(N-dp):
          D[i][k+dp]+=D[i2][k]
   
for a in sys.stdin:
  n,s=map(int,a.split())
  x=0
  if s<N:x=sum([D[i][s] for i in R if C[i]==n])
  print x
h,w=map(int,input().split())
n=int(input())
lis=list(map(int,input().split()))
ans=[]
cnt=0
s=""
hh=0
for i in range(n):
  for j in range(lis[i]):
    if hh==0:
      s=s+str(i+1)+" "
    else:
      s=str(i+1)+" "+s
    cnt+=1
    if cnt==w:
      ans.append(s)
      s=""
      cnt=0
      hh=(hh+1)%2
for i in range(h):
  print(ans[i])


### FIXED CODE ###

n = int(input())
cou1 = 0
cou2 = 0
cou4 = 0
lis = list(map(int,input().split()))
for i in range(n):
    if lis[i] % 2 == 0:
        if lis[i] % 4 == 0:
            cou4 += 1
        else:
            cou2 += 1
    else:
        cou1 += 1
if cou2 == 0:
    if cou1 <= cou4 + 1:
        print("Yes")
    else:
        print("No")
else:
    if cou1 <= cou4:
        print("Yes")
    else:
        print("No")
#include<bits/stdc++.h>

using namespace std;

int main(){
    int a, b, c; cin >> a >> b >> c;
    if(a == b == c){
        puts("No");
    }else{
        puts("Yes");
    }

}

### FIXED CODE ###

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

if a==b==c:
    print('No')
elif a==b or b==c or c==a:
    print('Yes')
else:
    print('No')
a,b = map(int,input().split())

soc=1
	while a<b :
		soc += 1
		a += a-1
if b==1:
	soc = 0
	
print(soc)

### FIXED CODE ###

a,b = map(int,input().split())
soc=1
for i in range(1,21):
	if i*(a-1)+1 >= b:
		soc = i
		break
if b==1:
	soc=0

print(soc)
s = list(map(int,input().split()))
N = s[0]
X = s[1]
L = list(map(int,input().split()))
a = 0
d = 0
while d <= X:
  if a == N+1:
    break
  else:
    d += L[a]
    a += 1 

print(a)
  

### FIXED CODE ###

s = list(map(int,input().split()))
N = s[0]
X = s[1]
L = list(map(int,input().split()))
a = 0
d = 0
while d <= X:
  if a >= N:
    a = N+1
    break
  else:
    d += L[a]
    a += 1 

print(a)
n=int(input())
man=list(map,int(input().split()))
can=list[]
for i in range(1,101):
  for j in range(len(man)):
    p=(man[j]-i)**2
	pp+=p
  can.append(pp)
can.sort(key=int)
print(can[0])
  

### FIXED CODE ###

n=int(input())
man=list(map(int,input().split()))
can=[]
for i in range(1,101):
	pp=0
	for j in range(len(man)):
		bp=(man[j]-i)**2
		pp+=bp
	can.append(pp)
can.sort(key=int)
print(can[0])
a,b=map(int,input().split())

ptint("{0} {1} {2:.8f}",format,(a//b,a%b,a/b))


### FIXED CODE ###

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

print("{0} {1} {2:.8f}".format(a//b,a%b,a/b))
"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

lst1 = []
lst2 = []
A1,B1 = map(int, input().split(" "))

A = factorization(A1)
B = factorization(B1)

for i in range(len(A)):
    lst1.append(A[i][0])

for i in range(len(B)):
    lst2.append(B[i][0])
# print(lst1)
# print(lst2)

lst1_set = set(lst1)
lst2_set = set(lst2)

result_set = lst1_set & lst2_set


# print(result_set)
if (A1 == 0 or B1 == 0):
    print(0)
else:
    print(len(result_set) + 1)

### FIXED CODE ###

#整数で受け取る
N = int(input())

number = 0
#奇数の数を数える
for i in range(1, N+1):
    if i % 2 != 0:
        number += 1

result = number / N

print(result)
N, H = list(map(int, input().split()))
A = [0]*N
B = [0]*N
for i in range(N):
    a, b = list(map(int, input().split()))
    A[i], B[i] = a, b
a = max(A)
T = 0
ct = 0
B.sort(reversed=True)
for b in B:
    if b > a:
        ct += 1
        T += b
    if T >= H:
        break
print(ct + max((H-T+a-1)//a, 0))

### FIXED CODE ###

N, H = list(map(int, input().split()))
A = [0]*N
B = [0]*N
for i in range(N):
    a, b = list(map(int, input().split()))
    A[i], B[i] = a, b
a = max(A)
T = 0
ct = 0
B = reversed(sorted(B))
for b in B:
    if b > a:
        ct += 1
        T += b
    if T >= H:
        break
print(ct + max((H-T+a-1)//a, 0))
if B / A >= C:
  print(C)
else:
  print(int(B/A))

### FIXED CODE ###

A, B, C = map(int ,input().split())
if B / A >= C:
  print(C)
elif B/ A < C:
  print(int(B/A))
a = input()

if a.isupper() == True:
  print("A")
elif a.islower() == True:
  print("a")
else:
  return

### FIXED CODE ###

a = input()
 
if a.isupper() == True and a.isalpha() == True:
  print("A")
elif a.islower() == True and a.isalpha() == True:
  print("a")
(W, H, x, y, r) = [int(i) for i in input().split()]

nums = input().split()
W = int(nums[0])
H = int(nums[1])
x = int(nums[2])
y = int(nums[3])
r = int(nums[4])

### FIXED CODE ###

nums = input().split()
W = int( nums[0])
H = int( nums[1])
x = int( nums[2])
y = int( nums[3])
r = int( nums[4])
    
if (x - r) >= 0 and (x + r) <= W:
    if (y - r) >= 0 and (y + r) <= H:
        print( "Yes")
    else:
        print( "No")
else:
    print( "No")
from decimal import *
getcontext().prec = 2
 
N = list(map(str, input().split()))
A = Decimal(N[0])
B = Decimal(N[1])
  
print(math.floor(A*B/100))

### FIXED CODE ###

from decimal import *

getcontext().prec = 20
 
N = list(map(str, input().split()))
A = Decimal(N[0])
B = Decimal(N[1])
  
print(int(A*B))
import numpy as np

N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]

sH = np.array(sorted(H), dtype=np.int64)
shift = sH[K-1:]
diff = shift - sH[:K]
ans = min(diff)
print(ans)

### FIXED CODE ###

import numpy as np

N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]

sH = np.array(sorted(H), dtype=np.int64)
shift = sH[K-1:]
diff = shift - sH[:len(shift)]
ans = min(diff)
print(ans)
N = int(input())
A_list = list(map(int, input().split()))
ans_list =[0] *　N

for i in range(N-1):
    for j in range(i+1,N):
        if A_list[i] %  A_list[j] == 0:
            ans_list[i] = 0
            if (A_list[j] %  A_list[i] == 0):
                ans_list[j] = 0
        elif(A_list[j] %  A_list[i] == 0):
            ans_list[j] = 0
print(int(sum(ans_list)))


### FIXED CODE ###

from sys import stdin
import numpy as np
input = stdin.readline

N = int(input())
A_list = list(map(int, input().split()))
# ans_list =np.ones(N)
# A_list = np.array(A_list)

# for i in range(N-1):
#     for j in range(i+1,N):
#         if A_list[i] %  A_list[j] == 0:
#             ans_list[i] = 0
#             if (A_list[j] %  A_list[i] == 0):
#                 ans_list[j] = 0
#         elif(A_list[j] %  A_list[i] == 0):
#             ans_list[j] = 0
# print(int(np.sum(ans_list)))
A_set = list(set(A_list))
maxA =  A_set[-1]
dp = [1] * (( 10 ** 6) + 1)

cntli = [0] * (( 10 ** 6) + 1)
unique =[]
for i in A_list:
    cntli[i] += 1
for i in range((( 10 ** 6) + 1)):
    if cntli[i] == 1:
        unique.append(i)

for elem in A_set:
    for i in range(2 * elem,  10 ** 6 + 1, elem):
        dp[i] = 0

ans = 0
for i in unique:
    if not (dp[i] == 0):
        ans += 1

print(ans)
R,G,B,N = map(int, input().split())
c = 0
for i in range(0,int(N/R)+1):
    for j in range(0,int((N-R*i)/G)+1):
	    if (N-R*i-G*j)%B = 0:
            c += 1
print(c)


### FIXED CODE ###

R,G,B,N = map(int, input().split())
c = 0
for i in range(0,int(N/R)+1):
    for j in range(0,int((N-R*i)/G)+1):
        if (N-R*i-G*j)%B == 0:
            c += 1
print(c)
mod = 1000000007
import sys
sys.setrecursionlimit(1000000)
x, y = map(int, input().split())
if (x+y) % 3 != 0:
    print(0)
else:
    a = ((2*x-y)//3)%mod
    b = ((2*y-x)//3)%mod
    n = (a + b)%mod
    kaijo = [1, 1]
    for i in range(2, n+1):
        kaijo.append(i*kaijo[i-1]%mod)
    def mul(a, b):
        return ((a % mod) * (b % mod)) % mod
    def power(x, y):
        if y == 0:
            return 1
        elif y == 1:
            return x % mod
        elif y % 2 == 0:
            return power(x, y // 2) ** 2 % mod
        else:
            return power(x, y // 2) ** 2 * x % mod
    def div(a, b):
        return mul(a, power(b, mod - 2))
    n_a = div(kaijo[n], kaijo[a])
    ans = div(n_a, kaijo[n-a])
    print(ans)


### FIXED CODE ###

mod = 1000000007
import sys
sys.setrecursionlimit(1000000)
x, y = map(int, input().split())
a = ((2*x-y)//3)
b = ((2*y-x)//3)
if (x+y) % 3 != 0 or a < 0 or b < 0:
    print(0)
else:
    n = (a + b)%mod
    kaijo = [1, 1]
    for i in range(2, n+1):
        kaijo.append(i*kaijo[i-1]%mod)
    def mul(a, b):
        return ((a % mod) * (b % mod)) % mod
    def power(x, y):
        if y == 0:
            return 1
        elif y == 1:
            return x % mod
        elif y % 2 == 0:
            return power(x, y // 2) ** 2 % mod
        else:
            return power(x, y // 2) ** 2 * x % mod
    def div(a, b):
        return mul(a, power(b, mod - 2))
    n_a = div(kaijo[n], kaijo[a])
    ans = div(n_a, kaijo[n-a])
    print(ans)
from collections import deque

x, y, a, b, c = map(int, input().split())
R = sorted(list(map(int, input().split())))[a - x:]
G = sorted(list(map(int, input().split())))[b - y:]
M = deque(sorted(list(map(int, input().split())), reverse=True))

ans = sum(R) + sum(G)
r, g, m = 0, 0, 0
for i in range(x + y):
    if not M:
        break
    if r >= x:
        if G[g] < M[m]:
        ans = ans - G[g] + M[m]
        g += 1
        m += 1
    elif g >= y:
        if R[r] < M[m]:
            ans = ans - R[r] + M[m]
        r += 1
        m += 1
    else:
        if

x, y, a, b, c = map(int, input().split())
R = sorted(list(map(int, input().split())), reverse=True)
G = sorted(list(map(int, input().split())), reverse=True)
M = sorted(list(map(int, input().split())), reverse=True)

ans, r, g, m = 0, 0, 0, 0
mr = R[x - 1]
mg = G[y - 1]

for i in range(x + y):
    if r >= x:
        if m >= c:
            ans += G[g]
            g += 1
        elif G[g] > M[m]:
            ans += G[g]
            g += 1
        else:
            ans += M[m]
            m += 1
    elif g >= y:
        if m >= c:
            ans += R[r]
            r += 1
        elif R[r] > M[m]:
            ans += R[r]
            r += 1
        else:
            ans += M[m]
            m += 1
    elif R[r] >= G[g]:
        if m >= c:
            ans += R[r]
            r += 1
        elif R[r] > M[m]:
            ans += R[r]
            r += 1
        else:
            ans += M[m]
            m += 1
    elif R[r] < G[g] or r >= x:
        if m >= c:
            ans += G[g]
            g += 1
        if G[g] > M[m]:
            ans += G[g]
            g += 1
        else:
            ans += M[m]
            m += 1
print(ans)


### FIXED CODE ###

x, y, a, b, c = map(int, input().split())
r = sorted(list(map(int, input().split())))[a - x:]
g = sorted(list(map(int, input().split())))[b - y:]
m = list(map(int, input().split()))

ans = sorted(r + g + m)
print(sum(ans[len(ans) - x - y:]))
h,w=map(int,input().split())

m=[input() for i in range(w)]




print(0)


### FIXED CODE ###

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

m=[input() for i in range(h)]


cnt=[[1000000 for i in range(w)] for j in range(h)]

if m[0][0]=="#":
    cnt[0][0]=1
else:
    cnt[0][0]=0

for y in range(h):
    for x in range(w):
        if x>0:
            if m[y][x-1]=="." and m[y][x]=="#":
                cnt[y][x]=min(cnt[y][x],cnt[y][x-1]+1)
            else:
                cnt[y][x]=min(cnt[y][x],cnt[y][x-1])
        if y>0:
            if m[y-1][x]=="." and m[y][x]=="#":
                cnt[y][x]=min(cnt[y][x],cnt[y-1][x]+1)
            else:
                cnt[y][x]=min(cnt[y][x],cnt[y-1][x])


print(cnt[h-1][w-1])
H, K = int(input().split())
array = list(map(int, input().split()))
A = sorted(array, reverse=True)
del A[0:K-1]
print(sum(A))

### FIXED CODE ###

H, K = map(int, input().split())
array = list(map(int, input().split()))
A = sorted(array, reverse=True)
del A[0:K]
print(sum(A))
x, y = map(int, input().split(" "))

print(int(math.log(y/x, 2)) + 1) 

### FIXED CODE ###

x, y = map(int, input().split(" "))

n = x
count = 0
while n <= y:
	n *= 2
	count += 1
print(count)
N = int(input())
#S = [input() for _ in range(N)]
S = ["".join(sorted(input())) for _ in range(N)]

ans = 0
for i in range(N):
    for j in range(i+1,N):
        if S[i] == S[j]:
            ans += 1
            S.pop(j)
            break
print(ans)

### FIXED CODE ###

N = int(input())
S =  ["".join(sorted(input())) for _ in range(N)]

Sdic = {}
ans = 0

for i in range(N):
    if S[i] not in Sdic.keys():
        Sdic[S[i]] = 1
    else:
        ans += Sdic[S[i]]
        Sdic[S[i]] += 1
print(ans)