#include <stdlib.h>
#include <stdio.h>

int main (void) {

    int datasets, i;

    fscanf(stdin,"%d\n",&datasets);

    for (i=0; i<datasets; i++) {
        int number, sentinel, key;
        fscanf(stdin,"%d",&number);
        
        /* Now for the rounding */
        sentinel = 10;
        while (number > sentinel) {
            key = (number / (sentinel/10)) % 10;
            if (key >= 5) {
                 number += (10 - key) * (sentinel/10);
            }
            else {
                 number -= key * (sentinel/10);
            }
            sentinel *= 10;
        }

        /* Now for the printing */
        printf("%d\n",number);
    }

    return 0;

}