Smallest Box That Still Works

You want samples from the density f(x)=20x3(1−x)f(x) = 20x^3(1-x) on (0,1)(0,1), which is the Beta(4,2) density. The method: draw a point uniformly from the rectangle (0,1)×(0,h)(0,1) \times (0,h) and keep its xx coordinate whenever the point falls under the graph of ff.

import random

def sample(h):
    draws = 0
    while True:
        x, y = random.random(), h * random.random()
        draws += 1
        if y <= 20 * x**3 * (1 - x):
            return x, draws

Which value of hh makes the expected value of draws as small as possible while keeping the sampler correct?

Answer format: round to 3 decimal places.