works for all but f > = 4