
open Scanf
open Printf

let flip f x y = f y x

let rec range a b = if a >= b then [] else a :: range (a+1) b

let read_int () = scanf " %d" (fun x -> x)
let rec read_ints n = if n = 0 then [] else let i = read_int () in i :: read_ints (n-1)

let rec for_iter a b f = if a >= b then [] else let x = f a in x :: for_iter (a+1) b f
let rec for_iter_ a b f = if a >= b then () else (f a; for_iter_ (a+1) b f)

let rat_cmp x y = match x, y with
  ((x1, y1), (x2, y2)) -> x1 * y2 < x2 * y1

let rat_max x y = if rat_cmp x y then y else x

let () =
  let [a; b; c; d; e; f] = read_ints 6 in
  let lim = f+1 in
  let warr = Array.make lim false in
  let sarr = Array.make lim false in
  for_iter_ 0 (f / (100*a) + 1) (fun x ->
    for_iter_ 0 ((f - 100*a*x) / (100*b) + 1) (fun y ->
      warr.(100*(a*x + b*y)) <- true));
  for_iter_ 0 (f / c + 1) (fun x ->
    for_iter_ 0 ((f - c*x) / d + 1) (fun y ->
      sarr.(c*x + d*y) <- true));

  let sentinel = (0, 100*a) in
  let h = List.fold_left rat_max sentinel in
  for_iter 0 lim (fun x -> for_iter 0 lim (fun y ->
    if warr.(x) && sarr.(y) && y <= e * x / 100 && x + y <= f then (y, x+y) else sentinel)
    |> h) |> h
  |> (fun (x, y) -> printf "%d %d\n" y x)
