F5 algorithm