Birational automorphisms of algebraic varieties with a pencil of double quadrics