finished ratio and diff algorithm for weighted sum