The solution is completely rewritten.