def grade(grades):
    round = []
    for i in grades:
        if i <= 37:
            round.append(i)
        else:
            k = 0
            for j in range(3):
                if (i + j) % 5 == 0:
                    k += 1
                    round.append(i + j)
            if k == 0:
                round.append(i)
    return round


n = int(input())
grades = []
for _ in range(n):
    grades_item = int(input())
    grades.append(grades_item)
result = grade(grades)
print(result)

d03957cded301f3da600184eaf6de857f76f78d6
<mask token>

def grade(grades):
    round = []
    for i in grades:
        if i <= 37:
            round.append(i)
        else:
            k = 0
            for j in range(3):
                if (i + j) % 5 == 0:
                    k += 1
                    round.append(i + j)
            if k == 0:
                round.append(i)
    return round


<mask token>

def grade(grades):
    round = []
    for i in grades:
        if i <= 37:
            round.append(i)
        else:
            k = 0
            for j in range(3):
                if (i + j) % 5 == 0:
                    k += 1
                    round.append(i + j)
            if k == 0:
                round.append(i)
    return round


<mask token>
for _ in range(n):
    grades_item = int(input())
    grades.append(grades_item)
<mask token>
print(result)

def grade(grades):
    round = []
    for i in grades:
        if i <= 37:
            round.append(i)
        else:
            k = 0
            for j in range(3):
                if (i + j) % 5 == 0:
                    k += 1
                    round.append(i + j)
            if k == 0:
                round.append(i)
    return round


n = int(input())
grades = []
for _ in range(n):
    grades_item = int(input())
    grades.append(grades_item)
result = grade(grades)
print(result)
