#include <bits/stdc++.h>
using namespace std;
long long x = 0, y = 0, n, b, cur, pre;
void get(long long &a) {
  scanf("%lld%lld", &n, &b);
  for (int i = 0; i < n; ++i) scanf("%lld", &pre), a = a * b + pre;
}
int main() {
  get(x), get(y);
  printf("%c\n", (x > y) ? '>' : ((x == y) ? '=' : '<'));
  return 0;
}
