I thought I had a glimmer of what you were asking, and was going to answer, but then I got stuck -
How does the sample data you provide related to the outcome? You have 1,10 in the first row of the former, but no reference to what to do with that in the latter. Where do we get the a, b or c? Is the a in "2a" the same a as in "4a" that adds/multiplies up to total1? And why is total2 got a 2a but a 4b instead of 4a? What determines that?
So I think it'll help to get you an answer if you could actually describe, step by step, how to get from the data to the answers that you want.
(For what it's worth, I have a suspicion this won't be a real hard thing to answer once it's described better.)