computation for BC first half working
updated type signature of sum