Prefix sum implemented