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

def solve(n):
	ans=0
	for a in range(int(n/4)+1):
		for b in range(a,int(n/3)+1):
			for c in range(b,int(n/2)+1):
				d=n-(a+b+c)
				if d>=c:
					if a==b==c==d:
						ans+=1#4!/4!
					elif a==b==c or b==c==d:
						ans+=4#4!/3!
					elif a==b and c==d:
						ans+=6#4!/(2!*2!)
					elif (a==b and c!=d) or (b==c) or (a!=b and c==d):
						ans+=12#4!/2!
					else:
						ans+=24#4!
				else:
					break
	return ans 


while True:
	try:
		n=int(input())
		print(solve(n))
	except EOFError:
		break

### FIXED CODE ###

M = 1000
DM = M * 2 + 1
 
def count(n):
    global M
    res = n + 1
    if n > M:
        res -= (n-M) * 2
    return res
 
def solve(n):
    cnt = 0
    for a in range(min(DM, n), -1, -1):
        b = n - a
        if b > DM:
            break
        cnt += count(a) * count(b)
    return cnt
 
while True:
    try:
        l = input()
    except EOFError:
        break
    nm = int(l)
    print(solve(nm))
### BUGGY CODE ###

import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
from functools import lru_cache
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 998244353

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


class Comb:
    def __init__(self, N):
        F = [1] * (N + 1)
        for i in range(N):
            F[i + 1] = (i + 1) * F[i] % mod

        self.d_inv = {}
        self.d_comb = {}
        self.F = F

    def inv(self, a):
        if a not in self.d_inv:
            self.d_inv[a] = pow(a, mod - 2, mod)
        return self.d_inv[a]

    def comb(self, a, b):
        if (a, b) not in self.d_comb:
            self.d_comb[(a, b)] = (self.F[a] * self.inv(self.F[a - b]) * self.inv(self.F[b])) % mod
            self.d_comb[(a, a - b)] = self.d_comb[(a, b)]
        return self.d_comb[(a, b)] 


def main():
    A, B, C, D = read_values()

    dp = [[0 for _ in range(D - B + 1)] for _ in range(C - A + 1)]
    dp[0][0] = 1

    for i in range(C - A):
        dp[i + 1][0] = dp[i][0] * B % mod
    for j in range(D - B):
        dp[0][j + 1] = dp[0][j] * A % mod

    for i in range(1, C - A + 1):
        for j in range(1, D - B + 1):
            dp[i][j] = dp[i - 1][j] * (B + j) + dp[i][j - 1] * (A + i) - dp[i - 1][j - 1] * (A + i - 1) * (B + j - 1) % mod

    print(dp[C - A][D - B] % mod)


if __name__ == "__main__":
    main()



### FIXED CODE ###

import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
from functools import lru_cache
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 998244353

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    A, B, C, D = read_values()

    dp = [[0 for _ in range(D - B + 1)] for _ in range(C - A + 1)]
    dp[0][0] = 1

    for i in range(C - A):
        dp[i + 1][0] = dp[i][0] * B % mod
    for j in range(D - B):
        dp[0][j + 1] = dp[0][j] * A % mod

    for i in range(1, C - A + 1):
        for j in range(1, D - B + 1):
            dp[i][j] = (dp[i - 1][j] * (B + j)) % mod + (dp[i][j - 1] * (A + i)) % mod - (dp[i - 1][j - 1] * (A + i - 1) * (B + j - 1)) % mod
            dp[i][j] %= mod

    print(dp[C - A][D - B] % mod)


if __name__ == "__main__":
    main()
### BUGGY CODE ###

N=int(input())
for n in range(1,N+1):
    s=0
    for x in range(1,101):
        for y in range(x,101):
            for z in range(y,101):
                fn=x*x+y*y+z*z+x*y+y*z+z*x
                if fn==n and x==y and x==z:
                    s=s+1
                if fn==n and x<y and y==z:
                    s=s+3
                if fn==n and x==y and y<z:
                    s=s+3              
                if fn==n and x<y and y<z:
                    s=s+6    
    print(s)    

### FIXED CODE ###

N=int(input())
ans=[0]*(N+1)
for x in range(1,101):  
    for y in range(1,101):
        for z in range(1,101):
            fn=x**2+y**2+z**2+x*y+y*z+z*x
            if fn>N:
                break
            else:
                ans[fn]=ans[fn]+1
for n in range(1,N+1):
    print(ans[n])
### BUGGY CODE ###

import numpy as np
n=input()
data=list(map(int,input().split()))
is_i=0
num=sorted(data)
count=num[1]
if 2<len(data):
    while num[0]<count and any([x%count!=0 for x in num[1::]]):
        count=int(count/2)+1
for i in range(count+1)[::-1]:
    is_i=0
    for j in range(len(data)):
        if data[j]%i!=0:
            is_i+=1
    if is_i<=1:
        print(i)
        break

### FIXED CODE ###

from fractions import gcd
import numpy as np
n=int(input())
data=list(map(int,input().split()))
left=np.zeros(n+1,dtype=np.int)
right=np.zeros(n+1,dtype=np.int)
kotae=1
for i in range(n):
    left[i+1]=gcd(left[i],data[i])
    right[n-i-1]=gcd(right[n-i],data[n-i-1])
for j in range(n):
    num=gcd(left[j],right[j+1])
    kotae=max(num,kotae)
print(kotae)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
L = [0] * (10 ** 6 + 1)
S = set()

for a in A:
    if a in S:
        L[a] = 1
    S.add(a)
    for i in range(2, 10 ** 6 + 1):
        if a * i > 10 ** 6:
            break
        L[a * i] = 1

ans = 0
for a in A:
    if L[a] == 0:
        ans += 1

print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
A.sort()
L = [0] * (10 ** 6 + 1)
S = set()

for a in A:
    if L[a]:
        continue
    if a in S:
        L[a] = 1
    S.add(a)
    for i in range(2, 10 ** 6 + 1):
        if a * i > 10 ** 6:
            break
        L[a * i] = 1

ans = 0
for a in A:
    if L[a] == 0:
        ans += 1

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

import math
import bisect

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
if N > M:
  A_small = A[0:N - M]
  A = A[N - M:]
else:
  A_small = []

for i in range(M):
  if (len(A) > 1 and A[-1] < A[-2]):
    a = A.pop(-1)
    bisect.insort(A, a)
  A[-1] /= 2.0

A.extend(A_small)
amount = 0
for a in A:
  amount += math.floor(a)
print(amount)

### FIXED CODE ###

import math
import heapq

N, M = list(map(int, input().split()))
A = list(map(lambda a: -int(a), input().split()))
A.sort()
heapq.heapify(A)

for i in range(M):
  a = heapq.heappop(A)
  a = -(-a / 2.0)
  heapq.heappush(A, a)

amount = 0
for a in A:
  amount += math.floor(-a)
print(amount)
### BUGGY CODE ###

c=11
i=11
d=0
a = int(input())
if a>11:
    while i<3234566668:
        i+=1
        f=0
        l = [int(x) for x in list(str(i))]
        for j in range(1,len(str(i))):
            if abs(l[j-1]-l[j])>1:
                f=1
            if l[j-1]-l[j]<-1 and d==0:
                i+=8*10**(len(str(i))-j-1)-1
                d=1
                break
        if f==0:
            c+=1
            d=0
        if c==a:
            print(i)
            break
else:
    print(a)

### FIXED CODE ###

import queue
count=9
target=int(input())
q=queue.Queue()
for i in range(1,10):
    q.put(i)
if count>=target:
    print(target)

if count<target:
    while(1):
        a=q.get()
        if a%10!=0:
            q.put(a*10+a%10-1)
            count+=1
            if count==target:
                print(a*10+a%10-1)
                break
        q.put(a*10+a%10)
        count+=1
        if count==target:
            print(a*10+a%10)
            break
        if a%10!=9:
            q.put(a*10+a%10+1)
            count+=1
            if count==target:
                print(a*10+a%10+1)
                break
### BUGGY CODE ###

import numpy as np

N = int(input())
A = np.array(list(map(int,input().split())))

ans = 0

for i in range(N):
    C = np.cumsum(A[i:])
    ans +=len(C[C==0])

print(ans)

### FIXED CODE ###

from collections import defaultdict

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

C = defaultdict(int)

ans = 0
sumA = 0
for a in A:
    sumA += a
    C[sumA] += 1
    if C[sumA] >=2:
        ans += C[sumA]-1
        
for i in range(1,C[0]+1): ans+= 1
    
print(ans)
### BUGGY CODE ###

import sys
readline=sys.stdin.readline

N = int(readline())

DIV = 10 ** 9 + 7

dp = [[0] * 4 for i in range(N + 1)]

dp[0][0] = 1

for i in range(1, N + 1):
  dp[i][0] += (dp[i - 1][0] * 8) % DIV
  dp[i][0] %= DIV
  
  dp[i][1] += dp[i - 1][0] + (dp[i - 1][1] * 9) % DIV
  dp[i][1] %= DIV
  
  dp[i][2] += dp[i - 1][0] + (dp[i - 1][2] * 9) % DIV
  dp[i][2] %= DIV
  
  dp[i][3] += dp[i - 1][1] + dp[i - 1][2] + (dp[i - 1][3] * 10) % DIV
  dp[i][3] %= DIV
  
print(dp[-1][3])


### FIXED CODE ###

import sys
readline=sys.stdin.readline

N = int(readline())

DIV = 10 ** 9 + 7

# dp[i][j][k] = i - 1桁目で、すでに0が出た(j), すでに9が出た(k)

dp = [[[0] * 2 for j in range(2)] for i in range(N + 1)]

dp[0][0][0] = 1

for i in range(1, N + 1):
  dp[i][0][0] += dp[i - 1][0][0] * 8 # まだ0も9も出ない
  dp[i][0][0] %= DIV
  
  dp[i][1][0] += dp[i - 1][0][0] # 0が出た
  dp[i][1][0] += dp[i - 1][1][0] * 9 # 9以外何が出てもよい
  dp[i][1][0] %= DIV
  
  dp[i][0][1] += dp[i - 1][0][0] # 9が出た
  dp[i][0][1] += dp[i - 1][0][1] * 9 # 0以外何が出てもよい
  dp[i][0][1] %= DIV
  
  dp[i][1][1] += dp[i - 1][1][0] # 9が出た
  dp[i][1][1] += dp[i - 1][0][1] # 0が出た
  dp[i][1][1] += dp[i - 1][1][1] * 10 # 何が出てもよい
  dp[i][1][1] %= DIV
  
print(dp[-1][1][1])
### BUGGY CODE ###

import math
n = list(map(int, input().split()))
h = list(map(int, input().split()))
h = sorted(h, reverse = True)
i = 0
for i in range(n[1]):
    h[0] = h[0]/2
    h = sorted(h, reverse  = True)
    i = i + 1
for i in range(n[0]):
    h[i]= math.floor(h[i])
print(sum(h))

### FIXED CODE ###

import numpy as np
import heapq
n = list(map(int, input().split()))
h = list(map(lambda x: int(x)*-1, input().split()))
heapq.heapify(h)
for i in range(n[1]):
    small = heapq.heappop(h)
    heapq.heappush(h, -1*(-small//2))
print(-sum(h))
### BUGGY CODE ###

ta_c,ao_c,num = map(int,input().split())
 
for i in range(num):
    if ta_c > 0:
        ta_c -=1
    elif ao_c >0:
        ao_c -=1
 
print("{} {}".format(ta_c,ao_c))

### FIXED CODE ###

ta_c,ao_c,num = map(int,input().split())

if num <= ta_c:
    print(ta_c-num,ao_c)
elif ta_c < num <= ta_c + ao_c:
    ao_c = ta_c+ao_c - num
    ta_c = 0
    print(ta_c,ao_c)
else:
    ta_c, ao_c = 0,0
    print(ta_c,ao_c)
### BUGGY CODE ###

s=input()
u=int(s[-1])
s=s[:-1]
l=[0]*2019
l[0]=1
for i in s[::-1]:
  u=int(i)*10**len(str(u))+u
  l[u%2019]+=1
ans=0
for i in l:
  ans+=i*(i-1)//2
print(ans)

### FIXED CODE ###

s=input()
ans=0
u=0
l=[0]*2019
l[0]=1
for i,n in enumerate(map(int,s)):
  u=(u+n*pow(10,len(s)-i,2019))%2019
  l[u]+=1
for i in l:
  ans+=i*(i-1)//2
print(ans)
### BUGGY CODE ###

n = int(input())
s = []
dict = {}

for _ in range(n):
    car = input()
    s.append(car)

for i in range(n):
    if s[i] not in dict:
        dict[s[i]] = s.count(s[i])

max_d_list = [d[0] for d in dict.items() if d[1] == max(dict.values())]
sorted_list = sorted(max_d_list)
for i in sorted_list:
    print(i)

### FIXED CODE ###

import collections

n = int(input())
s = [input() for _ in range(n)]
c_sort = collections.Counter(s).most_common()
list_most = [c_sort[i][0] for i in range(len(c_sort)) if c_sort[i][1] == c_sort[0][1]]
for i in sorted(list_most):
    print(i)
### BUGGY CODE ###

import fractions
A, B = map(int, input().split())
max_n = fractions.gcd(A,B)
ans = 1
while max_n != 1:
    for i in range(2,max_n+1):
        if max_n % i == 0:
            while max_n % i == 0:
                max_n //= i
            ans += 1
            break
print(ans)

### FIXED CODE ###

import fractions
import math

def trial_division(n):
    a = [1]
    for i in range(2,int(math.sqrt(n)) + 1):
        while n % i == 0:
            n //= i
            a.append(i)
    a.append(n)
    return a


A, B = map(int, input().split())
max_n = fractions.gcd(A,B)

ans = set(trial_division(max_n))
print(len(ans))
### BUGGY CODE ###

line = input().rstrip()
N = int(line)
line = input().rstrip()
line = line.split(' ')
mult = 1

for i in range(N):
    A = int(line[i])
    mult = mult * A

if mult > 10 ** 18:
    mult = -1

print(mult)


### FIXED CODE ###

import math

line = input().rstrip()
N = int(line)
line = input().rstrip()
line = line.split(' ')
mult = 1

numbers = []
for i in range(N):
    numbers.append(int(line[i]))
numbers.sort()

if numbers[0] == 0:
    mult = 0
else:
    for A in numbers:
        if math.log10(mult) + math.log10(A) > 18.0:
            mult = -1
            break
        mult = mult * A
        if mult > 10**18:
            mult = -1
            break

print(mult)
### BUGGY CODE ###

import sys

S=sys.stdin.readline()
l=len(S)

mod=10**9+7

a=0
ab=0
ans=0
all=1

for x  in S:
	if x=="A":
		a+=all
	elif x=="B":
		ab+=a
	elif x=="C":
		ans+=ab
	elif x=="?":
		ans = ans*3 + ab
		ab = ab*3 + a
		a = a*3 + all
		all *= 3

	ans%=mod
	ab%=mod
	a%=mod
	all%mod


print ans%mod


### FIXED CODE ###

S=raw_input()

M=10**9+7

all=1
abc=0
ab=0
a=0

for x in S:
	if x=="A":
		a+=all
	if x=="B":
		ab+=a
	if x=="C":
		abc+=ab

	if x=="?":
		abc=abc*3+ab
		ab=ab*3+a
		a= a*3+all
		all*=3

	abc%=M
	ab%=M
	a%=M
	all%=M


print abc%M
### BUGGY CODE ###

n = int(input())
x = input()
a = x.count('1')
b = int(x,2)
# print (b)

ary = [None for i in range(200010)]
ary[0] = 0

def f(n):
  if ary[n] is not None:
    return ary[n]
  b = bin(n).count('1')
  r = 1 + f(n%b)
  ary[n] = r
  return ary[n]


for i in range(200010):
  f(i)

a1 = a + 1
a0 = a - 1

ans = [0 for i in range(n)]
for i, j in enumerate(reversed(list(x))):
  if j == '0':
    x = b + pow(2,i,a1)
    # y = x %a1
    x %= a1
    ans[i] = ary[x]+1
  else:
    if a0 != 0:
      x = b - pow(2,i,a0)
      # y = x %a0
      x %= a0
      ans[i] = ary[x]+1
    else:
      ans[i] = 0
ans.reverse()
for i in ans:
  print (i)

### FIXED CODE ###

n = int(input())
x = input()
a = x.count('1')
b = int(x,2)
# print (b)

ary = [None for i in range(200010)]
ary[0] = 0

def f(n):
  if ary[n] is not None:
    return ary[n]
  b = bin(n).count('1')
  r = 1 + f(n%b)
  ary[n] = r
  return ary[n]


a1 = a + 1
a0 = a - 1
for i in range(200010):
  f(i)


one = [1] * 200010
zero = [1] * 200010
for i in range(1, 200010):
    if a0 != 0:
        one[i] = one[i-1] * 2 % a0
    zero[i] = zero[i-1] * 2 % a1


ans = [0 for i in range(n)]
c1 = b%a1
if a0 != 0:
  c0 = b%a0
for i in range(n-1, -1, -1):
  if x[n-1-i] == '0':
    y = c1 + zero[i]
    # y = x %a1
    y %= a1
    print (ary[y]+1)
  else:
    if a0 != 0:
      y = c0 - one[i]
      y %= a0
      print (ary[y]+1)
    else:
      print (0)
# ans.reverse()
# for i in ans:
#   print (i)
### BUGGY CODE ###

S = input()
mod = 2019

t = len(S)
l = [0] * t
for i in range(t-1, -1, -1):
    l[i] = int(S[i:]) % mod
l.append(0)

from collections import Counter

def nC2(n):
    return n * (n - 1) // 2


l = list(Counter(l).values())

ans = 0
for i in l:
    ans += nC2(i)

print(ans)

### FIXED CODE ###

S = input()
mod = 2019

t = len(S)
l = [0] * (t + 1)
for i in range(t-1, -1, -1):
    l[i] = (l[i+1] + int(S[i]) * pow(10, t-i-1, mod)) % mod

from collections import Counter

def nC2(n):
    return n * (n - 1) // 2

l = list(Counter(l).values())

ans = 0
for i in l:
    ans += nC2(i)

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

import sys
sys.setrecursionlimit(10**6)
N,Q=map(int,input().split())
L=[[] for _ in range(N)]
for _ in range(N-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    L[a].append(b)
    L[b].append(a)
CL=[0]*N
for _ in range(Q):
    p,x=map(int,input().split())
    CL[p-1]+=x

AL=[0]*N
ed=[0]*N
def dfs(val, now):
    ed[now]=1
    val+=CL[now]
    AL[now]=val
    for p in L[now]:
        if ed[p]==0:
            dfs(val,p)
dfs(0,0)
print(" ".join(map(str,AL)))

### FIXED CODE ###

import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)
N,Q=map(int,input().split())
L=[[] for _ in range(N)]
for _ in range(N-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    L[a].append(b)
    L[b].append(a)
CL=[0]*N
for _ in range(Q):
    p,x=map(int,input().split())
    CL[p-1]+=x

AL=[0]*N
ed=[0]*N
q=[(0,0)]
while len(q)!=0:
    now,val=q.pop(-1)
    ed[now] = 1
    val += CL[now]
    AL[now] = val
    for p in L[now]:
        if ed[p] == 0:
            q.append((p,val))
print(" ".join(map(str,AL)))
### BUGGY CODE ###

import math

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

for i in range(int(math.pow(P, 1 / N)) + 1, 0, -1):
    if P % (i ** N) == 0:
        print(i)
        break


### FIXED CODE ###

n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    for i in range(1, round(p**(1/n))+1):
        if p % i**n ==0:
            res = i
    print(res)
### BUGGY CODE ###

import numpy as np
INF = 10 ** 18
H, N = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
dp = [INF for i in range(H + 1)]

dp[0] = 0

for i in range(N):
    for j in range(H):
        if j - ab[i][0] + 1 >= 0:
            dp[j + 1] = min(dp[j + 1], dp[j - ab[i][0] + 1] + ab[i][1])
        else:
            dp[j + 1] = min(dp[j + 1], dp[0] + ab[i][1])

print(dp[-1])

### FIXED CODE ###

INF = 10 ** 18
H, N = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
dp = [INF for i in range(H + 1)]

dp[0] = 0

for i in range(N):
    for j in range(H):
        if j - ab[i][0] + 1 >= 0:
            dp[j + 1] = min(dp[j + 1], dp[j - ab[i][0] + 1] + ab[i][1])
        else:
            dp[j + 1] = min(dp[j + 1], dp[0] + ab[i][1])

print(dp[-1])
### BUGGY CODE ###

def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return list(map(str, input().split()))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
  r, g, b, n = input_list()
  min_num = min([r,g,b])
  ans = 0
  for x in range(n//r+1):
    for y in range(n//g+1):
      rr = r*x
      gg = g*y
      if rr + gg > n:
        continue
      bb = (n - rr - gg)
      if bb % b != 0:
        continue
      ans += 1
  print(ans)
  
import math
import fractions
import collections
import itertools
from functools import reduce
main()

### FIXED CODE ###

def input_list():
  return list(map(int, input().split()))

def main():
  r, g, b, n = input_list()
  ans = 0
  for x in range(n//r+1):
    for y in range(n//g+1):
      rr = r*x
      gg = g*y
      if rr + gg > n:
        continue
      bb = (n - rr - gg)
      if bb % b != 0:
        continue
      ans += 1
  print(ans)

main()
### BUGGY CODE ###

def main():
    a, b, c, d, e, f = [int(i) for i in input().split()]
    #print(a, b, c, d, e, f)
    
    L_UNIT = 100
    result_sw, result_s = 0, 0
    ans = -10000.

    water_list = []
    sugar_list = []

    for t_a in range( int( f / (a * L_UNIT) ) + 1 ):
        #print("a")
        for t_b in range( int( f / (b * L_UNIT) ) + 1 ):
            #print("b")
            #sugar_lim = e * (a * t_a + b * t_b)
            water_list.append(a * t_a * L_UNIT + b * t_b * L_UNIT)
            
    for t_c in range( int( f / c ) + 1 ):
        #print("c")
        for t_d in range( int( f / d ) + 1 ):
            #print("d")
            sugar_list.append( c * t_c + d * t_d )
            
    for water in water_list:
        for sugar in sugar_list:
            sugar_lim = e * (water / L_UNIT)
            if( sugar <= sugar_lim  and 0 < (water + sugar) and (water + sugar) <= f):
                noudo = 100 * sugar / (water + sugar)
                #print(noudo)
                if(ans < noudo):
                    ans = noudo
                    result_sw = sugar + water
                    result_s = sugar
    #print(ans)                    
    print( "{} {}".format(result_sw, result_s) )
    
if __name__=="__main__":
    main()

### FIXED CODE ###

def main():
    a, b, c, d, e, f = [int(i) for i in input().split()]
    #print(a, b, c, d, e, f)
    
    L_UNIT = 100
    result_sw, result_s = 0, 0
    ans = -10000.

    water_list = []
    sugar_list = []

    for t_a in range( int( f / (a * L_UNIT) ) + 1 ):
        #print("a")
        for t_b in range( int( f / (b * L_UNIT) ) + 1 ):
            #print("b")
            #sugar_lim = e * (a * t_a + b * t_b)
            if( (a * t_a * L_UNIT + b * t_b * L_UNIT) <= f ):
                water_list.append(a * t_a * L_UNIT + b * t_b * L_UNIT)
            
    for t_c in range( int( f / c ) + 1 ):
        #print("c")
        for t_d in range( int( f / d ) + 1 ):
            #print("d")
            if( (c * t_c + d * t_d) <= f):
                sugar_list.append( c * t_c + d * t_d )
            
    for water in water_list:
        for sugar in sugar_list:
            sugar_lim = e * (water / L_UNIT)
            if( sugar <= sugar_lim  and 0 < (water + sugar) and (water + sugar) <= f):
                noudo = 100 * sugar / (water + sugar)
                #print(noudo)
                if(ans < noudo):
                    ans = noudo
                    result_sw = sugar + water
                    result_s = sugar
    #print(ans)                    
    print( "{} {}".format(result_sw, result_s) )
    
if __name__=="__main__":
    main()