Output gets much larger than though. Changed to long long