Add fenwick tree and add a builder script