#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
const ll MAX = 1001001;
const ll MOD = 1000000007;
const double pi = 2.0 * asin(1.0);
ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};
int main()
{
    ll a, b, w;
    cin >> a >> b >> w;
    w *= 1000;
    ll ans1 = 0;
    ll ans2 = 0;
    rep(i, 1000100)
    {
        if (a * i <= w && b * i >= w)
        {
            ans1 = i;
            break;
        }
    }
    rep(i, 1000100)
    {
        if (a * i <= w && b * i >= w)
        {
            ans2 = i;
        }
    }
    if (ans1 != 0 || ans2 != 0)
    {
        cout << ans1 << " " << ans2 << endl;
    }
    else
    {
        cout << "UNSATISFIABLE" << endl;
    }
}
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>
#include <bitset>
// #include <atcoder/all>
#include <fstream>
#include <random>
#include <cassert>

//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;
// using namespace atcoder;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e16;
const ll INF = 1e16;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(ll i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const long double PI = 3.1415926535897932;

using Graph = vector<vector<ll>>;

bool check(string s, string t)
{
	ll sz = 0, so = 0, tz = 0, to = 0;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == '0') sz++;
		else so++;

		if (t[i] == '0') tz++;
		else to++;
	}

	if (sz == tz && so == to)
		return true;
	else
		return false;
}

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(15);		// 15桁表示指定

	ll n;
	cin >> n;

	string s, t;
	cin >> s >> t;

	if (!check(s, t))
	{
		cout << -1 << endl;
		ret;
	}

	ll sc = 1;
	ll tc = 1;
	ll ans = 0;

	ll br = false;

	for (int i = 0; i < n; i++)
	{
		br = false;
		sc = max(sc, i + 1LL);
		tc = max(tc, i + 1LL);
		if (t[i] == s[i])
		{
			continue;
		}

		if (t[i] != s[i])
		{
			if (t[i] == '0')
			{
				for (; sc < n; sc++)
				{
					if (s[sc] == '0')
					{
						ans++;

						char tmp = s[i];
						s[i] = s[sc];
						s[sc] = tmp;
						sc++; 
						br = true;
						break;
					}
				}
			}
			if (br)continue;
			if (s[i] == '0')
			{
				for (; tc < n; tc++)
				{
					if (t[tc] == '0')
					{
						ans++;

						char tmp = t[i];
						t[i] = t[tc];
						t[tc] = tmp;
						tc++;
						br = true;
						break;
					}
				}
			}
			if (br)continue;
		}
	}

	cout << ans << endl;

	return 0;
}