Fix ABC003_B in Ruby