Python Overflow Encountered In Square