write fenwick tree