<gh_stars>1-10
#!/bin/python3

import os
import sys

#
# Complete the gradingStudents function below.
#
def gradingStudents(grades):
    result = list()
    for grade in grades:
        result.append(grade if grade < 38 or (grade % 5) < 3 else grade + (5 - (grade % 5)))
    return result

                      
if __name__ == '__main__':
    f = open(os.environ['OUTPUT_PATH'], 'w')

    n = int(input())

    grades = []

    for _ in range(n):
        grades_item = int(input())
        grades.append(grades_item)

    result = gradingStudents(grades)

    f.write('\n'.join(map(str, result)))
    f.write('\n')

    f.close()

#!/bin/python3

import os
import sys

#
# Complete the gradingStudents function below.
#
def gradingStudents(grades):
    result = list()
    for grade in grades:
        result.append(grade if grade < 38 or (grade % 5) < 3 else grade + (5 - (grade % 5)))
    return result

                      
if __name__ == '__main__':
    f = open(os.environ['OUTPUT_PATH'], 'w')

    n = int(input())

    grades = []

    for _ in range(n):
        grades_item = int(input())
        grades.append(grades_item)

    result = gradingStudents(grades)

    f.write('\n'.join(map(str, result)))
    f.write('\n')

    f.close()
#!/bin/python3 # # Complete the gradingStudents function below. #