let () = Scanf.scanf "%d %d %d %d %d %d" @@ fun a b c d e f ->
  begin
  List.concat @@ Array.to_list @@ Array.init (1 + f / (100 * a)) (fun i ->
    List.concat @@ Array.to_list @@ Array.init (1 + (f - 100 * a * i) / (100 * b)) (fun j ->
      if i = 0 && j = 0 then []
      else
      List.concat @@ Array.to_list @@ Array.init (1 + (f - 100 * (a * i + b * j)) / c) (fun k ->
        if e * (a * i + b * j) < c * k then []
        else
        List.concat @@ Array.to_list @@ Array.init (1 + (f - 100 * (a * i + b * j) - c * k) / d) (fun l ->
          if e * (a * i + b * j) < c * k + d * l then []
          else [(100 * (a * i + b * j), c * k + d * l)]))))
  end
  |> (fun ((a, b) :: abs) ->
      List.fold_left (fun (a, b) (a', b') ->
        if b' * (a + b) <= b * (a' + b') then (a, b) else (a', b')) (a, b) abs)
  |> (fun (a, b) -> Printf.printf "%d %d\n" (a + b) b)

