#ABC476D. 自动咖啡厅 / Automat

自动咖啡厅 / Automat

Problem Statement

In the Kingdom of AtCoder, two kinds of bills are in circulation: 11-dollar bills and KK-dollar bills.

At Company J's fully automated cafeteria in the kingdom, desserts and drinks are sold as products.

The company's fully automated cafeteria has a dessert vending machine that sells NN desserts, and a drink vending machine that sells MM drinks. The desserts are numbered 11 through NN, and the drinks are numbered 11 through MM.

Dessert ii costs AiA_i dollars, and drink jj costs BjB_j dollars.

As payment, the dessert vending machine accepts both 11-dollar bills and KK-dollar bills, but the drink vending machine accepts only KK-dollar bills. Both vending machines give change using only 11-dollar bills. You cannot buy two or more of the same product.

Takahashi came to Company J's fully automated cafeteria with XX 11-dollar bills and YY KK-dollar bills.

Among the combinations of products that he can buy with the bills he has, find the maximum number of products he can purchase.

Constraints

  • 1≤N≤2×1051 \leq N \leq 2 \times 10^5
  • 1≤M≤2×1051 \leq M \leq 2 \times 10^5
  • 2≤K≤1092 \leq K \leq 10^9
  • 0≤X≤10150 \leq X \leq 10^{15}
  • 0≤Y≤1090 \leq Y \leq 10^9
  • 1≤Ai≤1091 \leq A_i \leq 10^9 (1≤i≤N1 \leq i \leq N)
  • 1≤Bj≤1091 \leq B_j \leq 10^9 (1≤j≤M1 \leq j \leq M)
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

  • NN MM KK
  • XX YY
  • A1A_1 A2A_2 …\ldots ANA_N
  • B1B_1 B2B_2 …\ldots BMB_M

Output

Output the answer.

2 3 10
50 6
22 30
20 12 24
4
  • By shopping as follows, Takahashi can buy four products.
    • Pay two 1010-dollar bills to buy drink 11. No change.
    • Pay two 1010-dollar bills to buy drink 22. The change is eight 11-dollar bills.
    • Pay two 1010-dollar bills and ten 11-dollar bills to buy dessert 22. No change.
    • Pay twenty-two 11-dollar bills to buy dessert 11. No change.

He cannot buy more than four products, so the answer is 44.

1 7 67
677677677766666 0
777666777
20 12 24 67 67 67 67
1
  • By shopping as follows, Takahashi can buy one product.
    • Pay 600000777666777600000777666777 11-dollar bills to buy dessert 11. The change is 600000000000000600000000000000 11-dollar bills.

He cannot buy more than one product, so the answer is 11.

20 20 30
605776135 133105105
97363214 218434035 697895427 109255624 299037330 227873982 195540071 411713803 828357845 244535208 138059186 639510883 39844882 707397687 371274487 696536603 351588202 319490007 47121612 87169661
32256972 567982330 554885983 299718223 443859449 687952877 264684780 666659381 576335424 941894234 406248934 321334900 423472560 863738035 213143887 384834384 468161291 673106162 164648316 15903323
22