#include <stdio.h>

void uru(int year);

int main(void)
{
    int a, b;
    int year;
    scanf("%d %d", &a, &b);
    for (year = a; year < b; ++year) {
        uru(year);
    }
    return 0;
}

void uru(int year)
{
    int R4, R100, R400;
    R4 = year % 4;
    R100 = year % 100;
    R400 = year % 400;
    if (R4 == 0 && R100 != 0) {
        printf("%d\n", year);
    } else if (R400 == 0) {
        printf("%d\n", year);
    }
}