#include <stdio.h>
void g(double x)
{
int c = 0, i;
if (x < 0) {
g(-x);
return;
}
while (x < 1) {
--c;
x *= 10;
}
while (x >= 10) {
++c;
x /= 10;
}
x -= (int)x;
x *= 10;
for (i = 0; i < 6; ++i) {
x -= (int)x;
x *= 10;
}
if (c < 0) {
c *= -1;
}
return;
}
int main()
{
double f = 271.8281828;
g(f);
f /= 10000;
g(f);
f *= -1;
g(f);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIGcoZG91YmxlIHgpCnsKICBpbnQgYyA9IDAsIGk7CgogIGlmICh4IDwgMCkgewogICAgcHV0Y2hhcignLScpOwogICAgZygteCk7CiAgICByZXR1cm47CiAgfQogIHdoaWxlICh4IDwgMSkgewogICAgLS1jOwogICAgeCAqPSAxMDsKICB9CiAgd2hpbGUgKHggPj0gMTApIHsKICAgICsrYzsKICAgIHggLz0gMTA7CiAgfQogIHB1dGNoYXIoeCArICcwJyk7CiAgcHV0Y2hhcignLicpOwogIHggLT0gKGludCl4OwogIHggKj0gMTA7CiAgZm9yIChpID0gMDsgaSA8IDY7ICsraSkgewogICAgcHV0Y2hhcih4ICsgJzAnKTsKICAgIHggLT0gKGludCl4OwogICAgeCAqPSAxMDsKICB9CiAgcHV0Y2hhcignZScpOwogIGlmIChjIDwgMCkgewogICAgcHV0Y2hhcignLScpOwogICAgYyAqPSAtMTsKICB9CiAgcHV0Y2hhcihjICsgJzAnKTsKICBwdXRjaGFyKCdcbicpOwogIHJldHVybjsKCn0KCmludCBtYWluKCkKewogIGRvdWJsZSBmID0gMjcxLjgyODE4Mjg7CiAgZyhmKTsKICBmIC89IDEwMDAwOwogIGcoZik7CiAgZiAqPSAtMTsKICBnKGYpOwogIHJldHVybiAwOwp9Cg==