a is branching factor, b determines how deep the tree goes, f(n) determines the weight of each level.