You can grab the field values using jQuery .val(). So if you wanted to get the value for field 5 you could use something like this
var field_five = jQuery('#input_2_5').val();
Input id's follow the naming convention of input_{form_id}_{field_id} and for multi input fields they will end with _{input_no}. You can confirm what the input id is by inspecting the field using the browsers developer tools where you would see something like this.
<li id="field_2_5" class="gfield">
<label class="gfield_label" for="input_2_5">Number</label>
<div class="ginput_container">
<input name="input_5" id="input_2_5" type="text" value="" class="medium" tabindex="5">
</div>
</li>
To use the retrieved value in the calculation the script would look like this:
<script>
gform.addFilter( 'gform_calculation_result', function(result, formulaField, formId, calcObj ){
if ( formulaField.field_id == "2" ) {
var field_five = jQuery('#input_2_5').val();
result = field_five * 12;
}
return result;
});
</script>