#include using namespace std; long long int p1,p2; int n,r; bool chk[1000]; long long int res = 0; int main(void) { cin.tie(0); ios::sync_with_stdio(false); cin >> p1; cin >> p2; cin >> n; for(int i=0;i> r; if(chk[r]) res += (p1+p2); chk[r] = true; } cout << res << '\n'; return 0; }