{"problem":{"name":"Strange Bank","description":{"content":"To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: *   $1$ yen (the currency of Japan)      *   $6$ yen, $6^2(","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc099_c"},"statements":[{"statement_type":"Markdown","content":"To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation:\n\n*   $1$ yen (the currency of Japan)\n    \n*   $6$ yen, $6^2(=36)$ yen, $6^3(=216)$ yen, ...\n    \n*   $9$ yen, $9^2(=81)$ yen, $9^3(=729)$ yen, ...\n    \n\nAt least how many operations are required to withdraw exactly $N$ yen in total?\nIt is not allowed to re-deposit the money you withdrew.\n\n## Constraints\n\n*   $1 \\leq N \\leq 100000$\n*   $N$ is an integer.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc099_c","tags":[],"sample_group":[["127","4\n\nBy withdrawing $1$ yen, $9$ yen, $36(=6^2)$ yen and $81(=9^2)$ yen, we can withdraw $127$ yen in four operations."],["3","3\n\nBy withdrawing $1$ yen three times, we can withdraw $3$ yen in three operations."],["44852","16"]],"created_at":"2026-03-03 11:01:14"}}