problem link. Can someone please share their approach.

# how to solve MARVEL BOX?

there are only 2 cases possible

(x,x,x,a+b+c=x)

(x,x,a+b=x,c+d=x)

for 1st:

so lets just go through all possible x,

find number of ways such that a+b+c=x,lets say it is val

so ans of first type ans1=((no.of.x)C3)*val

for 2nd:

lets just go through all possible x,

find number of ways of ways of choosing 4 numbers a,b,c,d such that ((a+b)=x and (c+d)=x) or ((a+c)=x and (b+d)=x) or ((a+d)=x and (b+c)=x)

let this be val3

so ans of second type ans2=((no.of.x)C2)*val2

res=ans1+ans2

try thinking of some dp for val,val3…