The starting value is 3 gallons of milk.
It declined at 0.7 gallons per month.
For the declining months subtract 0.7 for each month:
Start: 3.0 gallons
1 month: 3 -0.7 = 2.3
2 months: 2.3 - 0.7 = 1.6
3 months: 1.6 - 0.7 = 0.9
4 months: 0.9 -0.7 = 0.2
After 4 months it increased by 0.7 per month, so now add 0.7 each month:
5 months: 0.2 + 0.7 = 0.9
6 months: 0.9 + 0.7 = 1.6
7 months: 1.6 + 0.7 = 2.3
8 months: 2.3 +0.7 = 3.0
Now find the total for the month:
0.2 gallons was month 4
2.3 gallons was 7 months
3.0 gallons was 8 months
1.6 gallons was 2 months