function next_multiple(grade){
for (let i = grade; i < 101; i++){
if (i % 5 === 0)
return i;
}
}
function processData(input) {
var pass , fail ,not_app , value ;
var arr = input.split('\n');
var n = Number(arr[0]);
for (let i = 1; i <= n; i++) {
value = next_multiple(arr[i]) - Number(arr[i])
if (arr[i] < 38) {
fail = Number(arr[i])
console.log(fail);
}
if (arr[i] >= 38 && (value) < 3) {
pass = Number(arr[i]) + value
console.log(pass);
}
if(value >= 3 && arr[i] >= 38 ){
not_app = Number(arr[i])
console.log(not_app);
}
}
}
process.stdin.resume();
process.stdin.setEncoding("ascii");
_input = "";
process.stdin.on("data", function (input) {
_input += input;
});
process.stdin.on("end", function () {
processData(_input);
});