I need an algorithm
2K