#include <bits/stdc++.h>
using namespace std;
bool is_lucky(int num)
{
int digit = 0;
while (num > 0)
{
digit = num % 10;
num /= 10;
if(digit != 4 && digit != 7)
return false;
}
return true;
}
int main()
{
int a, b; cin >> a >> b;
int flag = 0;
for (int i = a; i <= b; i++)
{
if(is_lucky(i))
{
cout << i << " ";
flag++;
}
}
if(flag == 0) cout << -1;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpib29sIGlzX2x1Y2t5KGludCBudW0pCnsKCWludCBkaWdpdCA9IDA7Cgl3aGlsZSAobnVtID4gMCkKCXsKCQlkaWdpdCA9IG51bSAlIDEwOwoJCW51bSAvPSAxMDsKCQlpZihkaWdpdCAhPSA0ICYmIGRpZ2l0ICE9IDcpCgkJCXJldHVybiBmYWxzZTsKCX0KCXJldHVybiB0cnVlOwp9CgppbnQgbWFpbigpCnsKCWludCBhLCBiOyBjaW4gPj4gYSA+PiBiOwoJaW50IGZsYWcgPSAwOwoJZm9yIChpbnQgaSA9IGE7IGkgPD0gYjsgaSsrKQoJewoJCWlmKGlzX2x1Y2t5KGkpKQoJCXsKCQkJY291dCA8PCBpIDw8ICIgIjsKCQkJZmxhZysrOwoJCX0KCX0KCWlmKGZsYWcgPT0gMCkgY291dCA8PCAtMTsgCglyZXR1cm4gMDsKfQ==