#include <iostream>
#include <sstream>
#include <cmath>
#include <functional>
#include <vector>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int a, b, w;
    cin >> a >> b >> w;
    w *= 1000;

    int mx = -1;
    int mn = 1001001001;
    for (int i = 1; i <=1e6; ++i) {
        double p = (double)w / i;
        if (a <= p && p <= b) {
            mx = max(mx, i);
            mn = min(mn, i);
        }
    }

    if (mx == -1 && mn == 1001001001) { cout << "UNSATISFIABLE" << endl; }
    else { cout << mn << " " << mx << endl; }
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define indexed_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
//find_by_order = returns pointer to element at that pos
//order_of_key = returns pos of the given element
#define indexed_multiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define all(x)  (x).begin(),(x).end() 
#define mem1(a)  memset(a,-1,sizeof(a))
#define mem0(a)  memset(a,0,sizeof(a))  
#define int long long
#define endl "\n"
typedef vector<int> vi;
typedef pair<int,int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for (int i = a; i <b; i++)
int MOD = 1e9 + 7;
#define boost
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.F>>a.S;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.F<<" "<<a.S;return out;}
template<class _T>inline void read(_T &_a)
{
    bool f=0; char _c=getchar(); _a=0;
    while(_c<'0'||_c>'9'){ if(_c=='-') f=1; _c=getchar(); }
    while(_c>='0'&&_c<='9'){ _a=(_a<<3)+(_a<<1)-'0'+_c; _c=getchar(); }
    if(f) _a=-_a;
}

const long long INF=1e18;
int T;
//modular expoentiation
int modularExponentiation(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return modularExponentiation((x*x)%M,n/2,M);
    else                             //n is odd
        return ((x%M)*((modularExponentiation((x*x)%M,(n-1)/2,M))%M))%M;

}


int32_t main()
{ 
   /*  ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL); */
    int a,b,c;
cin>>a>>b>>c;
    a=a%10;
    int d=0;
    int temp= a;
    for(int i=1;i<100;i++)
    {   
            temp *=a;
    
        if((temp)%10==a)
        {
            d=i;
            break;
        }
    
    }
/*     debug1(d); */
    int ans = modularExponentiation(b,c,d);
    if(ans==0)
    ans=d;
  int op =a;
    for(int i=0;i<ans-1;i++)
    op=op*a;

    cout<<op%10<<endl;



	// you should actually read the stuff at the bottom
 
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
	* DON'T GET STUCK ON ONE APPROACH
*/
return 0;
}