output_description: Print the minimum time required for all of the people to reach City 6, in
  minutes.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      A
      B
      C
      D
      E
attempt: inf = input().split()
  X = int(inf[0])
  Y = int(inf[1])
  Z = int(inf[2])
  K = int(inf[3])
  
  A = [int(i) for i in input().split()]
  B = [int(i) for i in input().split()]
  C = [int(i) for i in input().split()]
  ab = []
  for a in A:
      for b in B:
          ab += [a + b]
  ab.sort(reverse=True)
  C.sort(reverse=True)
  state = [ab[0] + i for i in C]
  count = 0
  while count < K:
      x = max(state)
      print(x)
      count += 1
      i = state.index(x)
      j = ab.index(x - C[i])
      if j < X * Y - 1:
          state[i] = ab[j + 1] + C[i]
      else:
          state[i] = -1
  
problem_description: Statement
  
  In 2028 and after a continuous growth, AtCoder Inc. finally built an empire
  with six cities (City 1, 2, 3, 4, 5, 6)!
  
  There are five means of transport in this empire:
  
    * Train: travels from City 1 to 2 in one minute. A train can occupy at most A people.
    * Bus: travels from City 2 to 3 in one minute. A bus can occupy at most B people.
    * Taxi: travels from City 3 to 4 in one minute. A taxi can occupy at most C people.
    * Airplane: travels from City 4 to 5 in one minute. An airplane can occupy at most D people.
    * Ship: travels from City 5 to 6 in one minute. A ship can occupy at most E people.
  
  For each of them, one vehicle leaves the city at each integer time (time 0, 1,
  2, ...).
  
  There is a group of N people at City 1, and they all want to go to City 6.  
  At least how long does it take for all of them to reach there? You can ignore
  the time needed to transfer.
samples: [{"input": "5\n    3\n    2\n    4\n    3\n    5", "output": "7\n    \n\nOne possible way to travel is as follows. First, there are N = 5 people at\nCity 1, as shown in the following image:\n\n![ ](https://img.atcoder.jp/ghi/9c306138eddc8a2e08acfa5da19bdfe8.png)\n\nIn the first minute, three people travels from City 1 to City 2 by train. Note\nthat a train can only occupy at most three people.\n\n![ ](https://img.atcoder.jp/ghi/bd30b5ab37fc06951c9f5256bb974e4f.png)\n\nIn the second minute, the remaining two people travels from City 1 to City 2\nby train, and two of the three people who were already at City 2 travels to\nCity 3 by bus. Note that a bus can only occupy at most two people.\n\n![ ](https://img.atcoder.jp/ghi/50f2e49a770a30193fc53588ec8475b3.png)\n\nIn the third minute, two people travels from City 2 to City 3 by train, and\nanother two people travels from City 3 to City 4 by taxi.\n\n![ ](https://img.atcoder.jp/ghi/d6d80dc50abe58190905c8c5ea6ba345.png)\n\nFrom then on, if they continue traveling without stopping until they reach\nCity 6, all of them can reach there in seven minutes.  \nThere is no way for them to reach City 6 in 6 minutes or less.\n\n* * *"}, {"input": "10\n    123\n    123\n    123\n    123\n    123", "output": "5\n    \n\nAll kinds of vehicles can occupy N = 10 people at a time. Thus, if they\ncontinue traveling without stopping until they reach City 6, all of them can\nreach there in five minutes.\n\n* * *"}, {"input": "10000000007\n    2\n    3\n    5\n    7\n    11", "output": "5000000008\n    \n\nNote that the input or output may not fit into a 32-bit integer type."}]