sum(n - j*f, j = 1..B)