main = do
    xs <- fmap (map read . words) getLine :: IO [Int]
    putStrLn $ solve xs

solve xs = case solve' xs of
    (water, suger) -> unwords [show (water + suger), show suger]
solve' [a, b, c, d, e, f] = foldl (\(mw, ms) (w, s) -> if (mw + ms) * s >= (w + s) * ms then (w, s) else (mw, ms)) (0, 0) $
    filter (\(water, suger) -> 100 * suger <= e * water)
            [(walter, suger) |
              walter <- [100, 200 .. f],
              suger <- [1 .. f],
              walter + suger <= f,
              bezout (100 * a) (100 + b) walter,
              bezout c d suger]

-- ax + by = c | x, y >= 0 and a, b, c >=0
bezout :: Int -> Int -> Int -> Bool
bezout a b c = case take 1 $ filter ((==) 0 . flip mod a) [c - y * b | y <- [0 .. c `div` b]] of
    [] -> False
    _  -> True
