Under construction

Still being built. Things may change

Welcome Kit

Interview

Time limit0.1sMemory limit1024 MB

Summary
Find the fewest T-shirt bundles of size T that cover each size's requests, and the maximum pen bundles of size P with the leftover single pens.
Level

Easy2 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

The welcome kit for participants at the on-site Grand Arena event on February 3, 2024 includes one T-shirt and one pen. The vendor accepts orders only under the following conditions.

  • T-shirts come in six sizes: S, M, L, XL, XXL, and XXXL. T-shirts can only be ordered in bundles of TT shirts of the same size.
  • The pen is a single type. Pens can be ordered in bundles of PP or one at a time.

Of the NN participants, S,M,L,XL,XXL,XXXLS, M, L, XL, XXL, XXXL people requested T-shirts of sizes S, M, L, XL, XXL, and XXXL, respectively. Extra T-shirts are allowed, but there must not be a shortage, and each shirt must be given out in the requested size. The number of pens must match the number of participants exactly, with no surplus and no shortage.

Find the minimum number of bundles of TT T-shirts to order, and the maximum number of bundles of PP pens that can be ordered, along with the number of single pens to order in that case.

Input

The first line contains the number of participants NN. (1≤N≤109)(1 \le N \le 10^9)

The second line contains the number of requests for each T-shirt size, S,M,L,XL,XXL,XXXLS, M, L, XL, XXL, XXXL, separated by spaces. (0≤S,M,L,XL,XXL,XXXL≤N;(0 \le S, M, L, XL, XXL, XXXL \le N; S+M+L+XL+XXL+XXXL=N)S + M + L + XL + XXL + XXXL = N)

The third line contains the integers TT and PP, the bundle sizes for T-shirts and pens, separated by a space. (2≤T,P≤109)(2 \le T, P \le 10^9)

Output

On the first line, print the minimum number of bundles of TT T-shirts to order.

On the next line, print the maximum number of bundles of PP pens that can be ordered, followed by the number of single pens to order in that case.

Examples1

  1. Example 1

    Input
    23
    3 1 4 1 5 9
    5 7
    
    Expected output
    7
    3 2