#include <bits/stdc++.h>
using namespace std;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;


const int maxn = 1e6 + 5;

ll pw(ll x, ll y, ll mod) {
    ll res=1;
    while (y) {
	if (y%2) res=res*x%mod;
	x=x*x%mod;y=y/2;
    }
    return ((res%mod)+mod)%mod;
}


int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

    ll A,B,C;

    cin>>A>>B>>C;

    ll p = pw(B, C, 4)+4;
    
    ll ans = pw(A, p, 10);
    
    // ans %= 10;
    // ans += 10;
    // ans %= 10;
    
    out(ans);
    
    
    return 0;
}

#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#define ri register int
const int N = 1e6 + 618;
using namespace std;
int v,t,s,d;
int main(){
	scanf("%d%d%d%d",&v,&t,&s,&d);
	if(d < v * t||d > v * s) printf("Yes");
	else
		printf("No");
	return 0;
}

