let us suppose parameter value 10 & 20

for 1 st year

3x1+5x2=G=10

x1+7x2=G=20

if solving equation in 1 year getting the value p1 & q1 which is =G=10 & 20

for second year

3x1+5x2=G=10-(p1-10) if value 10-(p1-10) is neg then leave the equation 1 in second year

x1+7x2=G=20-(q1-10)

for third year

3x1+5x2=G=10-(p2-10) if value 10-(p1-10) is neg in 2nd year then (p2-10) will be equal to zero in third year

x1+7x2=G=20-(q2-10)

how to set this equation for several year in loop and with if condition