first step of a* algoritm