def max_items_possible():

    n = int(input())
    req = [0] + list(map(int, input().split()))
    stock = [0] + list(map(int, input().split()))
    cost = [0] + list(map(int, input().split()))
    budget = int(input())

    u = 0
    low = 0
    high = 10**18  # 1e18

    while low <= high:
        mid = (low + high) // 2
        total_cost = 0
        possible = True

        for j in range(1, n + 1):
            needed = req[j] * mid
            shortage = needed - stock[j]
            
            if shortage > 0:
                item_cost = shortage * cost[j]
                total_cost += item_cost
                
 
                if total_cost > budget:
                    possible = False
                    break

        if possible:
            u = mid
            low = mid + 1  # Try to make more items
        else:
            high = mid - 1  # Reduce the target number of items

    print(u)