mikhael,
для медитации, ввести 40 в 1 инпут
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script>
window.addEventListener("DOMContentLoaded", function() {
var b = document.querySelectorAll(".form-control.form-text.form-number");
[40, 25, 45, 310, 70].forEach(function(c, a) {
a *= 2;
b[a] && b[a].addEventListener("input", function() {
b[a + 1].value = +(this.value == c)
})
})
});
</script>
</head>
<body>
<input class="form-control form-text form-number" type="text" id="edit-submitted-4otvet" name="submitted[4otvet]" step="1">
<input class="form-control form-text form-number" type="text" id="edit-submitted-4rez" name="submitted[4rez]" value="0" step="1">
</body>
</html>