Fill in the grid with the numbers 1 to 4. In each row and each column is each number exactly once. There are also in each row and column two blackened cells. The numbers on the edge give the sum of the squares between the two blackened fields in the row or column respectivly.
Smaller example with numbers 1 - 3: