#include <stdio.h>
int main()
{
int x = 2014, y;
for (y = 2014; y > 1; y /= 2) {
x = x * x % 10000;
if (y % 2) x = x * 2014 % 10000;
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbigpCnsKICAgIGludCB4ID0gMjAxNCwgeTsKICAgIGZvciAoeSA9IDIwMTQ7IHkgPiAxOyB5IC89IDIpIHsKICAgICAgICB4ID0geCAqIHggJSAxMDAwMDsKICAgICAgICBpZiAoeSAlIDIpIHggPSB4ICogMjAxNCAlIDEwMDAwOwogICAgfQogICAgcHJpbnRmKCIlMDRkXG4iLCB4KTsKCiAgICByZXR1cm4gMDsKfQo=