Manual Algorithm for Budget Allocation  & ALgorithm explanation