/*
 * Author : Andrew J
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define vz(x) x.size()
using ll = long long;
using ii = pair <int , int>;
void in(int &x);
const int N = 105;
const int INF = 1e9 + 50;
const int MOD = 1e9 + 7;
double dp[N][N][N];
bool vis[N][N][N];

double ddiv(double a, double b) {
  return a / b;
}

double f(int gold, int silver, int bronze) {
  if (gold == 100 || silver == 100 || bronze == 100) return 0;

  double &sol = dp[gold][silver][bronze];
  if (vis[gold][silver][bronze]) return sol;
  vis[gold][silver][bronze] = 1;

  sol = 1;
  sol += ddiv(gold, gold + silver + bronze) * f(gold + 1, silver, bronze);
  sol += ddiv(silver, gold + silver + bronze) * f(gold, silver + 1, bronze);
  sol += ddiv(bronze, gold + silver + bronze) * f(gold, silver, bronze + 1);

  return sol;
}

int main() {
  int a, b, c; scanf("%d%d%d", &a, &b, &c);
  memset (vis, false, sizeof vis);
  printf("%.10lf\n", f(a, b, c));
  return 0;
}

void in(int &x){
  bool neg = false;
  register int c;
  x = 0;
  c = getchar();
  if(c == '-'){
    neg = true;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x *= -1;
}

#include <bits/stdc++.h>
using namespace std;
string s,t;
int main()
{
	long long n;
	cin>>n;
	cin>>s>>t;
	vector<int> ss,tt;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='0')
		{
			ss.push_back(i);
		}
		if(t[i]=='0')
		{
			tt.push_back(i);
		}
	}
	if(ss.size()!=tt.size()) 
	{
		cout<<-1<<endl;
	}
	else{
		long long ans=0;
		for(int i=0;i<ss.size();i++)
		{
			if(ss[i]!=tt[i]) ans++;
		}
		cout<<ans<<endl;
	}
	return 0;
}