The three-dimensional knapsack problem with balancing constraints