using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Numerics; namespace foryuki { class Program { static void Main(string[] args) { string N = Console.ReadLine(); string M = Console.ReadLine(); BigInteger n = BigInteger.Parse(N); BigInteger m = BigInteger.Parse(M); BigInteger ans= 1; for (int i = 0; i < m; i++) { ans = ans * n; } Console.WriteLine(ans % 10); Console.ReadLine(); } //------------------------------------------------------------- static int[] ConvertStringArrayToIntArray(string[] array) { return Array.ConvertAll(array, str => int.Parse(str)); } static List ConvertStringArrayToIntList(string[] str) { var list = new List(); foreach (var c in str) { list.Add(int.Parse(c)); } return list; } } }