#include<iostream>
#include<math.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<stdio.h>
#include<fstream>
using namespace std;
const long long MOD=1000000007;
int inv(int a)
{
return a==1?1:(long long)(MOD-MOD/a)*inv(MOD%a)%MOD;
}
long long C(long long n,long long m)
{
if(m<0)return 0;
if(n<m)return 0;
if(m>n-m)m=n-m;
long long up=1,down=1;
for(long long i=0;i<m;i++)
{
up=up*(n-i)%MOD;
down=down*(i+1)%MOD;
}
return up*inv(down)%MOD;
}
int main(){
int a,b,k;
cin>>a>>b>>k;
long long ans =0;
for(int i=0;i<=k;i++){
int sum = i * a + (k-i) *b;
int flag = 0;
while(sum){
if(sum%10 == a || sum %10 == b){
sum/=10;
continue;
}
flag=1;
break;
}
if(flag==0){
ans = (ans+C(k,i))%MOD;
}
}
cout<<ans<<endl;
return 0;
}