#include <bits/stdc++.h>   using namespace std;   const int N = 15;   long long Get_Num(int num[], int b, int n) {     long long number = 0;     long long in = 1;     for (int i = n - 1; i >= 0; i--) {       number += num[i] * in;       in = in * b;     }     return number;   }   int main() {     int x[N], y[N];     int b;     int n;     long long X, Y;     cin >> n >> b;     for (int i = 0; i < n; i++) {       cin >> x[i];     }     X = Get_Num(x, b, n);     cin >> n >> b;     for (int i = 0; i < n; i++) {       cin >> y[i];     }     Y = Get_Num(y, b, n);     if (X == Y) {       printf( = n );     } else if (X > Y) {       printf( > n );     } else {       printf( < n );     }     return 0;   }   