#!/usr/bin/env python
# -*- coding: UTF-8 -*-

class MyInt(int):
    def __add__(self, other):
        if isinstance(other, int):
            return int(self) + int(other)
        elif isinstance(other, str):
            try:
                return int(self) + int(other, 0)
            except ValueError:
                return str(self) + str(other)
        else:
            raise TypeError('Unhandled case: {} + {}'.format(
                type(self).__name__, type(other).__name__))

x = MyInt(3)
print(x + 'how')
print(x + '3')
print('JavaScript, мааам!')
