SLoW: Select Low-frequency Words! Automatic Dictionary Selection for Translation on Large Language Models