scoreboard players set min times_appeared 0

execute if score #ice_snake shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = ice_snake times_appeared
execute if score #ice_snake shop matches 1 if score ice_snake times_appeared < min times_appeared run scoreboard players operation min times_appeared = ice_snake times_appeared

execute if score #air_field shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = air_field times_appeared
execute if score #air_field shop matches 1 if score air_field times_appeared < min times_appeared run scoreboard players operation min times_appeared = air_field times_appeared

execute if score #explosive_fire shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = explosive_fire times_appeared
execute if score #explosive_fire shop matches 1 if score explosive_fire times_appeared < min times_appeared run scoreboard players operation min times_appeared = explosive_fire times_appeared

execute if score #fire_repelant shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = fire_repelant times_appeared
execute if score #fire_repelant shop matches 1 if score fire_repelant times_appeared < min times_appeared run scoreboard players operation min times_appeared = fire_repelant times_appeared

execute if score #meteor_rain shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = meteor_rain times_appeared
execute if score #meteor_rain shop matches 1 if score meteor_rain times_appeared < min times_appeared run scoreboard players operation min times_appeared = meteor_rain times_appeared

execute if score #dark_curse shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = dark_curse times_appeared
execute if score #dark_curse shop matches 1 if score dark_curse times_appeared < min times_appeared run scoreboard players operation min times_appeared = dark_curse times_appeared
execute if score min times_appeared matches -1 run scoreboard players set min times_appeared 0