Fixed so that loop doesn't stop when i!=k or i!=l. A is now initialized with the correct values.