execute @s ~ ~ ~ detect ~ ~1 ~ gravel 0 fill ~ ~-1 ~ ~ ~-1 ~ sand 0 replace air
execute @s ~ ~ ~ detect ~ ~1 ~ gravel 0 setblock ~ ~1 ~ air

execute @s ~ ~ ~ detect ~ ~1 ~ cobblestone 0 fill ~ ~-1 ~ ~ ~-1 ~ gravel 0 replace air
execute @s ~ ~ ~ detect ~ ~1 ~ cobblestone 0 setblock ~ ~1 ~ air