<select name="a" id="a">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<br>
<input type=text name="b" id="b">
<input type=text name="c" id="c" onclick="ff()">
<input type=text name="d" id="d">
<script>
function ff()
{
document.getElementById("c").value = document.getElementById("a").value - document.getElementById("b").value
document.getElementById("d").value = document.getElementById("a").value + document.getElementById("b").value
}
</script>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<br>
<input type=text name="b" id="b">
<input type=text name="c" id="c" onclick="ff()">
<input type=text name="d" id="d">
<script>
function ff()
{
document.getElementById("c").value = document.getElementById("a").value - document.getElementById("b").value
document.getElementById("d").value = document.getElementById("a").value + document.getElementById("b").value
}
</script>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<br>
<input type=text name="b" id="b">
<input type=text name="c" id="c" onclick="ff()">
<input type=text name="d" id="d">
<script>
function ff()
{
document.getElementById("c").value = document.getElementById("a").value * 1 - document.getElementById("b").value * 1
document.getElementById("d").value = document.getElementById("a").value * 1 + document.getElementById("b").value * 1
}
</script>