this might be very simple calculation but I\'m lost how to put this on a loop, in case where there is a very long list of same cases. I want to return a loop result that cal