Changed implementation to use long long

instead of long double. Everything still works.