Problem A
Problem B