#!/usr/bin/perl use strict; use warnings; my $n = <>; my $m = <>; $n = $n % 10; $m = $m % 10; my $ans; $ans = $n ** $m; $ans = $ans % 10; print "$ans\n"; exit;