My first algorithm