Javascript modification, Sum in output with discount on more selection

Code:

function totalIt() {
  var input = document.getElementsByName("product");
  var total = 0;
  for (var i = 0; i < input.length; i++) {
    if (input[i].checked) {
      total += parseFloat(input[i].value);
    }
  }
  document.getElementsByName("total")[0].value = "₹" + total.toFixed(2);
}

Conditions:

No discount on first select

50% discount on 2nd selection

After 3rd selection, each has 25% discount

Expected Output:
Each check(box)’s value is 100,

  • on selection 1, Output = 100 (No discount)
  • on selection 2, Output = 150 (50% discount in 2nd selection)
  • on selection 3, Output = 175 (50% discount in 2nd, 25% discount on 3rd selection)
  • on selection 4, Output = 200 (50% discount in 2nd, * 25% discount on 3rd selection selection)
  • on selection, Output = 225 (50% discount in 2nd, 25% discount on 3rd selection selection)