Gravar-mail: Implementing EM and Viterbi algorithms for Hidden Markov Model in linear memory