I'm assuming that the pair of RadioButtons aremutually exclusive( both fields assigned the same fieldname but a different export value).
In the example below, I named the radio buttons fields as "RB", then assign export values of "RB1" and "RB2" respectively.
The caluclating fileds are named with the same labels that you used in your inquiry to make it easier to visualize.
You can use the following script as a custom calculation script in the the (a*b) total field, for example:
event.value = this.getField("a").value * this.getField("b").value;
var f = this.getField("RB");
if (f.value == "RB1") {
this.getField("a").display = display.visible;
this.getField("b").display = display.visible;
event.target.display = display.visible;
} else {
this.getField("a").display = display.hidden;
this.getField("b").display = display.hidden;
event.target.display = display.hidden;
}
if (f.value == "RB2") {
this.getField("a1").display = display.visible;
this.getField("b1").display = display.visible;
this.getField("ab1").display = display.visible;
} else {
this.getField("a1").display = display.hidden;
this.getField("b1").display = display.hidden;
this.getField("ab1").display = display.hidden;
}