base for algoritm