





'''simple docstring'''






snake_case_     			=						[
    ["""ab-e1""", """ac-e3""", """ad-e5""", """bc-e4""", """bd-e2""", """be-e6""", """bh-e12""", """cd-e2""", """ce-e4""",
     """de-e1""", """df-e8""", """dg-e5""", """dh-e10""", """ef-e3""", """eg-e2""", """fg-e6""", """gh-e6""", """hi-e3"""],
    ["""ab-e1""", """ac-e3""", """ad-e5""", """bc-e4""", """bd-e2""", """be-e6""", """cd-e2""", """de-e1""", """df-e8""",
     """ef-e3""", """eg-e2""", """fg-e6"""],
    ["""ab-e1""", """ac-e3""", """bc-e4""", """bd-e2""", """de-e1""", """df-e8""", """dg-e5""", """ef-e3""", """eg-e2""",
     """eh-e12""", """fg-e6""", """fh-e10""", """gh-e6"""],
    ["""ab-e1""", """ac-e3""", """bc-e4""", """bd-e2""", """bh-e12""", """cd-e2""", """df-e8""", """dh-e10"""],
    ["""ab-e1""", """ac-e3""", """ad-e5""", """bc-e4""", """bd-e2""", """cd-e2""", """ce-e4""", """de-e1""", """df-e8""",
     """dg-e5""", """ef-e3""", """eg-e2""", """fg-e6"""]
]
def 				_lowerCamelCase(	UpperCamelCase__     :			Any		)		->	List[Any]:
    A							:							List[Any]				=    set()
    for row in edge_array:
        for item in row:
            distinct_edge.add(item[0]		)
    return list(UpperCamelCase__		)
def 				_lowerCamelCase(	UpperCamelCase__     :			int     ,							UpperCamelCase__     :			Dict		)		->	Optional[int]:
    A							:							Optional[int]				=    ['''0'''] * len(UpperCamelCase__		)
    for i, row in enumerate(UpperCamelCase__		):
        for item in row:
            if distinct_edge in item[0]:
                A							:							int				=    '''1'''
                break
    return "".join(UpperCamelCase__		)
def 				_lowerCamelCase(	UpperCamelCase__     :			Any		)		->	Union[str, Any]:
    A							:							Dict				=    get_distinct_edge(UpperCamelCase__		)
    A							:							List[str]				=    {}

    for item in distinct_edge:
        A							:							Union[str, Any]				=    get_bitcode(UpperCamelCase__     ,							UpperCamelCase__		)
        # print('bit',bit)
        # bt=''.join(bit)
        A							:							str				=    bit.count('''1'''		)
        A							:							Union[str, Any]				=    [s, bit]
    # Store [Distinct edge, WT(Bitcode), Bitcode] in descending order
    A							:							Dict				=    [
        [k, v[0], v[1]]
        for k, v in sorted(frequency_table.items()     ,							key=lambda UpperCamelCase__		: v[1][0]     ,							reverse=UpperCamelCase__		)
    ]
    return sorted_frequency_table
def 				_lowerCamelCase(	UpperCamelCase__     :			Union[str, Any]		)		->	Optional[Any]:
    A							:							Tuple				=    {}
    for _, item in enumerate(UpperCamelCase__		):
        nodes.setdefault(item[2]     ,							[]		).append(item[0]		)
    return nodes
def 				_lowerCamelCase(	UpperCamelCase__     :			Any		)		->	List[Any]:
    A							:							Dict				=    {}
    for key, value in nodes.items():
        A							:							Optional[Any]				=    value
    return cluster
def 				_lowerCamelCase(	UpperCamelCase__     :			int		)		->	Tuple:
    return [i * 100 / len(UpperCamelCase__		) for i in cluster]
def 				_lowerCamelCase(	)		->	None:
    print('''\nNodes\n'''		)
    for key, value in nodes.items():
        print(UpperCamelCase__     ,							UpperCamelCase__		)
    print('''\nSupport\n'''		)
    print(UpperCamelCase__		)
    print('''\n Cluster \n'''		)
    for key, value in sorted(cluster.items()     ,							reverse=UpperCamelCase__		):
        print(UpperCamelCase__     ,							UpperCamelCase__		)
    print('''\n Graph\n'''		)
    for key, value in graph.items():
        print(UpperCamelCase__     ,							UpperCamelCase__		)
    print('''\n Edge List of Frequent subgraphs \n'''		)
    for edge_list in freq_subgraph_edge_list:
        print(UpperCamelCase__		)
def 				_lowerCamelCase(	UpperCamelCase__     :			List[Any]     ,							UpperCamelCase__     :			Optional[int]     ,							UpperCamelCase__     :			List[Any]     ,							UpperCamelCase__     :			Any		)		->	List[Any]:
    for i in cluster[ca]:
        A							:							str				=    0
        A							:							Optional[int]				=    ca + 1
        while ca < max(cluster.keys()		):
            for j in cluster[ca]:
                if int(UpperCamelCase__     ,							2		) & int(UpperCamelCase__     ,							2		) == int(UpperCamelCase__     ,							2		):
                    if tuple(nodes[i]		) in graph:
                        graph[tuple(nodes[i]		)].append(nodes[j]		)
                    else:
                        A							:							Union[str, Any]				=    [nodes[j]]
                    count += 1
            if count == 0:
                A							:							Optional[Any]				=    ca + 1
            else:
                break
def 				_lowerCamelCase(	UpperCamelCase__     :			Any     ,							UpperCamelCase__     :			Tuple		)		->	List[Any]:
    A							:							int				=    cluster[max(cluster.keys()		)]
    A							:							Tuple				=    '''Header'''
    A							:							List[Any]				=    {}
    for i in x:
        if (["Header"],) in graph:
            graph[(["Header"],)].append(x[i]		)
        else:
            A							:							str				=    [x[i]]
    for i in x:
        A							:							Union[str, Any]				=    [['''Header''']]
    A							:							Union[str, Any]				=    1
    while i < max(UpperCamelCase__		) - 1:
        create_edge(UpperCamelCase__     ,							UpperCamelCase__     ,							UpperCamelCase__     ,							UpperCamelCase__		)
        A							:							str				=    i + 1
    return graph
def 				_lowerCamelCase(	UpperCamelCase__     :			Dict     ,							UpperCamelCase__     :			Tuple     ,							UpperCamelCase__     :			Optional[int]     ,							UpperCamelCase__     :			Tuple=None		)		->	List[str]:
    A							:							str				=    (path or []) + [start]
    if start == end:
        paths.append(UpperCamelCase__		)
    for node in graph[start]:
        if tuple(UpperCamelCase__		) not in path:
            my_dfs(UpperCamelCase__     ,							tuple(UpperCamelCase__		)     ,							UpperCamelCase__     ,							UpperCamelCase__		)
def 				_lowerCamelCase(	UpperCamelCase__     :			Optional[int]     ,							UpperCamelCase__     :			Optional[Any]     ,							UpperCamelCase__     :			Tuple		)		->	Optional[Any]:
    A							:							List[Any]				=    int(s / 100 * (len(UpperCamelCase__		) - 1)		)
    for i in cluster[k]:
        my_dfs(UpperCamelCase__     ,							tuple(cluster[k][i]		)     ,							(['''Header'''],)		)
def 				_lowerCamelCase(	UpperCamelCase__     :			Optional[int]		)		->	int:
    A							:							Any				=    []
    for edges in paths:
        A							:							Dict				=    []
        for j in range(len(UpperCamelCase__		) - 1		):
            A							:							int				=    list(edges[j]		)
            for e in temp:
                A							:							List[Any]				=    (e[0], e[1])
                el.append(UpperCamelCase__		)
        freq_sub_el.append(UpperCamelCase__		)
    return freq_sub_el
def 				_lowerCamelCase(	UpperCamelCase__     :			Union[str, Any]		)		->	int:
    for i in range(len(UpperCamelCase__		)		):
        for j in range(len(edge_array[i]		)		):
            A							:							List[str]				=    edge_array[i][j].split('''-'''		)
            A							:							Any				=    t


if __name__ == "__main__":
     preprocess(edge_array)
     snake_case_     			=						get_frequency_table(edge_array)
     snake_case_     			=						get_nodes(frequency_table)
     snake_case_     			=						get_cluster(nodes)
     snake_case_     			=						get_support(cluster)
     snake_case_     			=						construct_graph(cluster, nodes)
     find_freq_subgraph_given_support(60, cluster, graph)
     snake_case_     			=						[]
     snake_case_     			=						freq_subgraphs_edge_list(paths)
     print_all()







'''simple docstring'''






def 				_lowerCamelCase(	UpperCamelCase__     :			int = 1_000		)		->	int:
    A							:							Optional[Any]				=    [0, 3, 3, 5, 4, 4, 3, 5, 5, 4, 3, 6, 6, 8, 8, 7, 7, 9, 8, 8]
    # number of letters in twenty, thirty, ..., ninety (0 for numbers less than
    # 20 due to inconsistency in teens)
    A							:							Tuple				=    [0, 0, 6, 6, 5, 5, 5, 7, 6, 6]

    A							:							str				=    0

    for i in range(1     ,							n + 1		):
        if i < 1_000:
            if i >= 100:
                # add number of letters for "n hundred"
                count += ones_counts[i // 100] + 7

                if i % 100 != 0:
                    # add number of letters for "and" if number is not multiple
                    # of 100
                    count += 3

            if 0 < i % 100 < 20:
                # add number of letters for one, two, three, ..., nineteen
                # (could be combined with below if not for inconsistency in
                # teens)
                count += ones_counts[i % 100]
            else:
                # add number of letters for twenty, twenty one, ..., ninety
                # nine
                count += ones_counts[i % 10]
                count += tens_counts[(i % 100 - i % 10) // 10]
        else:
            count += ones_counts[i // 1_000] + 8
    return count


if __name__ == "__main__":
     print(solution(int(input().strip())))
