modular exp. iplemented, this solution use all cores on CPU, but I doubt that it is optimal solution