{"problem":{"name":"A. Arpa’s hard exam and Mehrdad’s naive cheat","description":{"content":"_There exists an island called Arpa’s land, some beautiful girls live there, as ugly ones do._ Mehrdad wants to become minister of Arpa’s land. Arpa has prepared an exam. Exam has only one question, ","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF742A"},"statements":[{"statement_type":"Markdown","content":"_There exists an island called Arpa’s land, some beautiful girls live there, as ugly ones do._\n\nMehrdad wants to become minister of Arpa’s land. Arpa has prepared an exam. Exam has only one question, given _n_, print the last digit of 1378_n_.\n\n<center>![image](https://espresso.codeforces.com/ac805c7c78540a009fed5a8407fb3448d2a085a6.png)</center>Mehrdad has become quite confused and wants you to help him. Please help, although it's a naive cheat.\n\n## Input\n\nThe single line of input contains one integer _n_ (0  ≤  _n_  ≤  109).\n\n## Output\n\nPrint single integer — the last digit of 1378_n_.\n\n[samples]\n\n## Note\n\nIn the first example, last digit of 13781 = 1378 is 8.\n\nIn the second example, last digit of 13782 = 1378·1378 = 1898884 is 4.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"_存在一个名为 Arpa 土地的岛屿，那里住着一些美丽的女孩，也有丑陋的女孩。_\n\nMehrdad 想成为 Arpa 土地的部长。Arpa 准备了一场考试，考试只有一道题：给定 #cf_span[n]，请输出 #cf_span[1378n] 的最后一位数字。\n\nMehrdad 感到非常困惑，希望你帮助他。请帮帮他吧，尽管这只是一个简单的作弊方法。\n\n输入的唯一一行包含一个整数 #cf_span[n]（#cf_span[0  ≤  n  ≤  109]）。\n\n请输出一个整数 —— #cf_span[1378n] 的最后一位数字。\n\n在第一个例子中，#cf_span[13781 = 1378] 的最后一位数字是 #cf_span[8]。\n\n在第二个例子中，#cf_span[13782 = 1378·1378 = 1898884] 的最后一位数字是 #cf_span[4]。\n\n## Input\n\n输入的唯一一行包含一个整数 #cf_span[n]（#cf_span[0  ≤  n  ≤  109]）。\n\n## Output\n\n请输出一个整数 —— #cf_span[1378n] 的最后一位数字。\n\n[samples]\n\n## Note\n\n在第一个例子中，#cf_span[13781 = 1378] 的最后一位数字是 #cf_span[8]。在第二个例子中，#cf_span[13782 = 1378·1378 = 1898884] 的最后一位数字是 #cf_span[4]。","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $, $ 0 \\leq n \\leq 10^9 $.  \n\n**Objective**  \nCompute the last digit of $ 1378^n $, i.e., compute $ 1378^n \\mod 10 $.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF742A","tags":["implementation","math","number theory"],"sample_group":[["1","8"],["2","4"]],"created_at":"2026-03-03 11:00:39"}}