def get_max_words_with_ngrams(max_words, word_ngrams):
    """
    Calculate the length of the longest possible sentence
    :param max_words: int, the length of the longest sentence
    :param word_ngrams: int
    :return: int, the length of the longest sentence with word n-grams
    """
    max_words_with_ng = 1
    for ng in range(word_ngrams):
        max_words_with_ng += max_words - ng
    return max_words_with_ng