Used recursion to calculate x^y in a O(log N) way