Ultrarelativistic black hole in an external electromagnetic field and gravitational waves in the Melvin universe