Dennis bought a packet of sugar. He kept 4/9 of it for his own use and accidentally spilled another 0.8 kg of it. He then gave the 5/7 of the remainder to his neighbour. If 1/5 of the neighbour's share was 350 g, what was the mass of the bag of sugar Dennis bought?

starting with x kg,

kept: 4/9 x, leaving 5/9 x
spilled 0.8, leaving 5/9 x - 0.8
gave: 5/7 (5/9 x - 0.8) = 25/63 x - 4/7, leaving 10/63 x - 8/35
Now we have
1/5 (10/63 x - 8/35) = 0.350
x = 12.465 kg

that's an odd amount to start with;
better check my math