function stock sum