Forward Algorithm