adding bitwise exam solution