a = [[0]*4 for x in range(3)] num = 1 for i in range(3): for j in range(4): a[i][j] = num num += 2 i,j = map(int,input().split()) print( a[i][j])