$( document ).ready(function() {
  var firstNumStr = '';
  var secondNumStr = '';
  var thirdNumStr = '';
  var whichNum = 1;
  
  var feet = 0;
  var shouldSum = false;
  var content = $('#lol').text().split('');
  
  for(var i = 0; i < content.length;++i) {
    if($.isNumeric(content[i])) {
      if(whichNum == 1) {
        firstNumStr += content[i];
      } else if(whichNum == 2) {
        secondNumStr += content[i];
      } else if(whichNum == 3) {
        thirdNumStr += content[i];
        if(i == content.length - 1)
          shouldSum = true;
      }
    } else if(content[i] == 'x') {
      whichNum++;
    } else {
      shouldSum = true; 
    }
    
    if(shouldSum) {
      
      var firstNum = parseInt(firstNumStr);
      var secondNum = parseInt(secondNumStr);
      var thirdNum = parseInt(thirdNumStr);
      
      var firstPseudoArea = firstNum * secondNum;
      var secondPseudoArea = firstNum * thirdNum;
      var thirdPseudoArea = secondNum * thirdNum;
      
      feet += ( 2 * firstPseudoArea) + (2 * secondPseudoArea) + (2 * thirdPseudoArea);
      
      feet += [firstPseudoArea, secondPseudoArea, thirdPseudoArea].sort(sortNumber)[0];
      
      whichNum = 1;
      firstNumStr = '';
      secondNumStr = '';
      thirdNumStr = ''; 
      shouldSum = false;
    }
  }
  $('#result').text('Result = ' + feet);
});

function sortNumber(a,b) {
    return a - b;
}

@@ -833,24 +833,213 @@
  %0A      var 
+orderedNums = %5BfirstNum, secondNum, thirdNum%5D.sort(sortNumber);%0A      feet += (2 * orderedNums%5B0%5D + 2 * orderedNums%5B1%5D);%0A      feet += (firstNum * secondNum * thirdNum);%0A      %0A      /*var 
 firstPseudoA
@@ -1357,24 +1357,26 @@
 )%5B0%5D;%0A      
+*/
 %0A      which

Update custom.js