Works correctly for i=10.