You can actually use Expression Manager to use one answer to set the value of another question, even if the other question is in another group (as is the case in your example).
Say your questions are 'a1' (1000X10X20), 'a2' (1000X10X21), 'b1' (1000X11X30), and 'b2' (1000X11X31), you would assign the values this way:
This code could be put in a question or help text. Since it uses the comma operator, it returns the final value (''), so nothing will be displayed. You can also call this from either group 10 or group 11, although calling from group 11 will avoid having Expression Manager warn you of potential errors. Lastly, you don't need to put this within a <script>.
Some relevant documentation can be found
here
.